summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-08-13 16:47:10 -0400
committerCara Salter <cara@devcara.com>2022-08-13 16:48:25 -0400
commitbc8d4d7e6dbc4954afc53abc80f597b94e816bf3 (patch)
tree68e8373e162d32f32a936c9cf2ee20e0c6c52a81
parentf05eb9e87ce3f8f72126e82299f32b940e3b29f0 (diff)
downloadsite-bc8d4d7e6dbc4954afc53abc80f597b94e816bf3.tar.gz
site-bc8d4d7e6dbc4954afc53abc80f597b94e816bf3.zip
no nix
l---------.direnv/flake-profile1
l---------.direnv/flake-profile-1-link1
-rw-r--r--.drone.yml44
-rw-r--r--.envrc1
-rw-r--r--default.nix16
-rw-r--r--flake.lock91
-rw-r--r--flake.nix126
-rw-r--r--nix/rust.nix10
-rw-r--r--nix/sources.json50
-rw-r--r--nix/sources.nix174
-rw-r--r--shell.nix16
11 files changed, 0 insertions, 530 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile
deleted file mode 120000
index 0c05709..0000000
--- a/.direnv/flake-profile
+++ /dev/null
@@ -1 +0,0 @@
-flake-profile-1-link \ No newline at end of file
diff --git a/.direnv/flake-profile-1-link b/.direnv/flake-profile-1-link
deleted file mode 120000
index b738dee..0000000
--- a/.direnv/flake-profile-1-link
+++ /dev/null
@@ -1 +0,0 @@
-/nix/store/334wfqshf6xiqw1i12rrx3a65pivy4wk-nix-shell-env \ No newline at end of file
diff --git a/.drone.yml b/.drone.yml
deleted file mode 100644
index f4a51af..0000000
--- a/.drone.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-kind: pipeline
-type: docker
-name: default
-
-steps:
- - name: build
- image: rust:latest
- commands:
- - cargo check
- - cargo build --release
-
- - name: deploy_binary
- image: appleboy/drone-scp
- settings:
- username: deploy
- key:
- from_secret: ssh_key
- host: kronos.devcara.com
- port: 22
- target: /usr/app/site/site
- source:
- - target/release/site
-
- when:
- event:
- - promote
- target:
- - production
-
- - name: restart_server
- image: appleboy/drone-ssh
- settings:
- username: deploy
- key:
- from_secret: ssh_key
- host: kronos.devcara.com
- port: 22
- script:
- - sudo systemctl restart site
- when:
- event:
- - promote
- target:
- - production
diff --git a/.envrc b/.envrc
deleted file mode 100644
index 3550a30..0000000
--- a/.envrc
+++ /dev/null
@@ -1 +0,0 @@
-use flake
diff --git a/default.nix b/default.nix
deleted file mode 100644
index a8a3c11..0000000
--- a/default.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ sources ? import ./nix/sources.nix, pkgs ? import sources.nixpkgs { } }:
-let
- rust = import ./nix/rust.nix { inherit sources; };
-
- naersk = pkgs.callPackage sources.naersk {
- rustc = rust;
- cargo = rust;
- };
-
- src = builtins.filterSource (path: type: type != "directory" ||
- builtins.baseNameOf path != "target") ./.;
-
-in naersk.buildPackage {
- inherit src;
- remapPathPrefix = true;
-}
diff --git a/flake.lock b/flake.lock
deleted file mode 100644
index c60e477..0000000
--- a/flake.lock
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "nodes": {
- "flake-utils": {
- "locked": {
- "lastModified": 1648297722,
- "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "mozillapkgs": {
- "flake": false,
- "locked": {
- "lastModified": 1645464064,
- "narHash": "sha256-YeN4bpPvHkVOpQzb8APTAfE7/R+MFMwJUMkqmfvytSk=",
- "owner": "mozilla",
- "repo": "nixpkgs-mozilla",
- "rev": "15b7a05f20aab51c4ffbefddb1b448e862dccb7d",
- "type": "github"
- },
- "original": {
- "owner": "mozilla",
- "repo": "nixpkgs-mozilla",
- "type": "github"
- }
- },
- "naersk": {
- "inputs": {
- "nixpkgs": "nixpkgs"
- },
- "locked": {
- "lastModified": 1648544490,
- "narHash": "sha256-EoBDcccV70tfz2LAs5lK0BjC7en5mzUVlgLsd5E6DW4=",
- "owner": "nix-community",
- "repo": "naersk",
- "rev": "e30ef9a5ce9b3de8bb438f15829c50f9525ca730",
- "type": "github"
- },
- "original": {
- "owner": "nix-community",
- "repo": "naersk",
- "type": "github"
- }
- },
- "nixpkgs": {
- "locked": {
- "lastModified": 1648219316,
- "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
- "type": "github"
- },
- "original": {
- "id": "nixpkgs",
- "type": "indirect"
- }
- },
- "nixpkgs_2": {
- "locked": {
- "lastModified": 1648219316,
- "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
- "type": "github"
- },
- "original": {
- "id": "nixpkgs",
- "type": "indirect"
- }
- },
- "root": {
- "inputs": {
- "flake-utils": "flake-utils",
- "mozillapkgs": "mozillapkgs",
- "naersk": "naersk",
- "nixpkgs": "nixpkgs_2"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/flake.nix b/flake.nix
deleted file mode 100644
index 2a83e6c..0000000
--- a/flake.nix
+++ /dev/null
@@ -1,126 +0,0 @@
-{
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- naersk.url = "github:nix-community/naersk";
- mozillapkgs = {
- url = "github:mozilla/nixpkgs-mozilla";
- flake = false;
- };
- };
-
- outputs = { self, nixpkgs, flake-utils, naersk, mozillapkgs }:
- flake-utils.lib.eachDefaultSystem (
- system: let
- pkgs = nixpkgs.legacyPackages."${system}";
- mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
- rust = (mozilla.rustChannelOf {
- date = "2022-03-31";
- channel = "nightly";
- sha256 = "k6wD6/2qNQ7rmIvGi1ddtKSTUXjXFbIr0Sg2mqF2nYg=";
- }).rust;
-
- naersk-lib = naersk.lib."${system}".override {
- cargo = rust;
- rustc = rust;
- };
- in
- rec {
- # `nix build`
- packages.carasite = naersk-lib.buildPackage {
- pname = "carasite";
- root = ./.;
- remapPathPrefix = true;
- buildInputs = with pkgs; [
- git
- ];
- overrideMain = attrs: {
- preBuild = ''
- cp -r templates /build/dummy-src/
- cp -r statics /build/dummy-src/
- '';
-
- postInstall = ''
- mv $out/bin/site $out/bin/carasite
-
- cp -rf $src/blog $out/blog
- cp -rf $src/statics $out/statics
- cp -rf $src/projects $out/projects
- '';
-
- };
- };
- defaultPackage = packages.carasite;
-
- # `nix run`
- apps.carasite = flake-utils.lib.mkApp {
- drv = packages.carasite;
- };
- defaultApp = apps.carasite;
-
- nixosModules.site = { config, lib, ... }: {
- options = {
- cara.services.carasite.enable = lib.mkEnableOption "enable cara's site";
- cara.services.carasite.domain = lib.mkOption {
- type = lib.types.str;
- default = "devcara.com";
- description = "The domain to use";
- };
-
- cara.services.carasite.port = lib.mkOption {
- type = lib.types.port;
- default = 3000;
- description = "The port to bind to";
- };
- };
-
- config = lib.mkIf config.cara.services.carasite.enable {
- users.groups.cara-site = {
- members = [ "cara-site" ];
- };
- users.users.cara-site = {
- createHome = true;
- isSystemUser = true;
- home = "/var/lib/cara-site";
- group = "cara-site";
- };
-
- systemd.services.cara-site = {
- wantedBy = [ "multi-user.target" ];
- environment = {
- PORT = "${toString (config.cara.services.carasite.port)}";
- };
- serviceConfig = {
- User = "cara-site";
- Group = "cara-site";
- Restart = "always";
- WorkingDirectory = "${defaultPackage}";
- ExecStart = "${defaultPackage}/bin/carasite";
- };
- };
-
- networking.firewall.allowedTCPPorts = [ 443 80 ];
-
- services.nginx = {
- enable = true;
- recommendedProxySettings = true;
- recommendedTlsSettings = true;
- virtualHosts."${config.cara.services.carasite.domain}" = {
- forceSSL = true;
- enableACME = true;
-
- locations."/" = {
- proxyPass = "http://127.0.0.1:${toString (config.cara.services.carasite.port)}";
- };
- };
- };
- };
- };
-
-
- # `nix develop`
- devShell = pkgs.mkShell {
- nativeBuildInputs = with pkgs; [ rustc cargo ];
- };
- }
- );
-}
diff --git a/nix/rust.nix b/nix/rust.nix
deleted file mode 100644
index 1419ec7..0000000
--- a/nix/rust.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ sources ? import ./sources.nix }:
-
-let
- pkgs =
- import sources.nixpkgs { overlays = [ (import sources.nixpkgs-mozilla) ]; };
- channel = "nightly";
- date = "2022-02-16";
- targets = [ ];
- chan = pkgs.rustChannelOfTargets channel date targets;
-in chan
diff --git a/nix/sources.json b/nix/sources.json
deleted file mode 100644
index 1a3725a..0000000
--- a/nix/sources.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "naersk": {
- "branch": "master",
- "description": "Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly. [maintainer: ???]",
- "homepage": "",
- "owner": "nmattia",
- "repo": "naersk",
- "rev": "2fc8ce9d3c025d59fee349c1f80be9785049d653",
- "sha256": "1jhagazh69w7jfbrchhdss54salxc66ap1a1yd7xasc92vr0qsx4",
- "type": "tarball",
- "url": "https://github.com/nmattia/naersk/archive/2fc8ce9d3c025d59fee349c1f80be9785049d653.tar.gz",
- "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
- },
- "niv": {
- "branch": "master",
- "description": "Easy dependency management for Nix projects",
- "homepage": "https://github.com/nmattia/niv",
- "owner": "nmattia",
- "repo": "niv",
- "rev": "9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a",
- "sha256": "1ajyqr8zka1zlb25jx1v4xys3zqmdy3prbm1vxlid6ah27a8qnzh",
- "type": "tarball",
- "url": "https://github.com/nmattia/niv/archive/9cb7ef336bb71fd1ca84fc7f2dff15ef4b033f2a.tar.gz",
- "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
- },
- "nixpkgs": {
- "branch": "release-20.03",
- "description": "Nix Packages collection",
- "homepage": "",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "eb73405ecceb1dc505b7cbbd234f8f94165e2696",
- "sha256": "06k21wbyhhvq2f1xczszh3c2934p0m02by3l2ixvd6nkwrqklax7",
- "type": "tarball",
- "url": "https://github.com/NixOS/nixpkgs/archive/eb73405ecceb1dc505b7cbbd234f8f94165e2696.tar.gz",
- "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
- },
- "nixpkgs-mozilla": {
- "branch": "master",
- "description": "Mozilla overlay for Nixpkgs.",
- "homepage": "",
- "owner": "mozilla",
- "repo": "nixpkgs-mozilla",
- "rev": "f233fdc4ff6ba2ffeb1e3e3cd6d63bb1297d6996",
- "sha256": "1rzz03h0b38l5sg61rmfvzpbmbd5fn2jsi1ccvq22rb76s1nbh8i",
- "type": "tarball",
- "url": "https://github.com/mozilla/nixpkgs-mozilla/archive/f233fdc4ff6ba2ffeb1e3e3cd6d63bb1297d6996.tar.gz",
- "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
- }
-}
diff --git a/nix/sources.nix b/nix/sources.nix
deleted file mode 100644
index 1938409..0000000
--- a/nix/sources.nix
+++ /dev/null
@@ -1,174 +0,0 @@
-# This file has been generated by Niv.
-
-let
-
- #
- # The fetchers. fetch_<type> fetches specs of type <type>.
- #
-
- fetch_file = pkgs: name: spec:
- let
- name' = sanitizeName name + "-src";
- in
- if spec.builtin or true then
- builtins_fetchurl { inherit (spec) url sha256; name = name'; }
- else
- pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
-
- fetch_tarball = pkgs: name: spec:
- let
- name' = sanitizeName name + "-src";
- in
- if spec.builtin or true then
- builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
- else
- pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
-
- fetch_git = name: spec:
- let
- ref =
- if spec ? ref then spec.ref else
- if spec ? branch then "refs/heads/${spec.branch}" else
- if spec ? tag then "refs/tags/${spec.tag}" else
- abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
- in
- builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
-
- fetch_local = spec: spec.path;
-
- fetch_builtin-tarball = name: throw
- ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
- $ niv modify ${name} -a type=tarball -a builtin=true'';
-
- fetch_builtin-url = name: throw
- ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
- $ niv modify ${name} -a type=file -a builtin=true'';
-
- #
- # Various helpers
- #
-
- # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
- sanitizeName = name:
- (
- concatMapStrings (s: if builtins.isList s then "-" else s)
- (
- builtins.split "[^[:alnum:]+._?=-]+"
- ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
- )
- );
-
- # The set of packages used when specs are fetched using non-builtins.
- mkPkgs = sources: system:
- let
- sourcesNixpkgs =
- import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
- hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
- hasThisAsNixpkgsPath = <nixpkgs> == ./.;
- in
- if builtins.hasAttr "nixpkgs" sources
- then sourcesNixpkgs
- else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
- import <nixpkgs> {}
- else
- abort
- ''
- Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
- add a package called "nixpkgs" to your sources.json.
- '';
-
- # The actual fetching function.
- fetch = pkgs: name: spec:
-
- if ! builtins.hasAttr "type" spec then
- abort "ERROR: niv spec ${name} does not have a 'type' attribute"
- else if spec.type == "file" then fetch_file pkgs name spec
- else if spec.type == "tarball" then fetch_tarball pkgs name spec
- else if spec.type == "git" then fetch_git name spec
- else if spec.type == "local" then fetch_local spec
- else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
- else if spec.type == "builtin-url" then fetch_builtin-url name
- else
- abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
-
- # If the environment variable NIV_OVERRIDE_${name} is set, then use
- # the path directly as opposed to the fetched source.
- replace = name: drv:
- let
- saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
- ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
- in
- if ersatz == "" then drv else
- # this turns the string into an actual Nix path (for both absolute and
- # relative paths)
- if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
-
- # Ports of functions for older nix versions
-
- # a Nix version of mapAttrs if the built-in doesn't exist
- mapAttrs = builtins.mapAttrs or (
- f: set: with builtins;
- listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
- );
-
- # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
- range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
-
- # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
- stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
-
- # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
- stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
- concatMapStrings = f: list: concatStrings (map f list);
- concatStrings = builtins.concatStringsSep "";
-
- # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
- optionalAttrs = cond: as: if cond then as else {};
-
- # fetchTarball version that is compatible between all the versions of Nix
- builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
- let
- inherit (builtins) lessThan nixVersion fetchTarball;
- in
- if lessThan nixVersion "1.12" then
- fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
- else
- fetchTarball attrs;
-
- # fetchurl version that is compatible between all the versions of Nix
- builtins_fetchurl = { url, name ? null, sha256 }@attrs:
- let
- inherit (builtins) lessThan nixVersion fetchurl;
- in
- if lessThan nixVersion "1.12" then
- fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
- else
- fetchurl attrs;
-
- # Create the final "sources" from the config
- mkSources = config:
- mapAttrs (
- name: spec:
- if builtins.hasAttr "outPath" spec
- then abort
- "The values in sources.json should not have an 'outPath' attribute"
- else
- spec // { outPath = replace name (fetch config.pkgs name spec); }
- ) config.sources;
-
- # The "config" used by the fetchers
- mkConfig =
- { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
- , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
- , system ? builtins.currentSystem
- , pkgs ? mkPkgs sources system
- }: rec {
- # The sources, i.e. the attribute set of spec name to spec
- inherit sources;
-
- # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
- inherit pkgs;
- };
-
-in
-mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index dfd7db7..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ pkgs ? import <nixpkgs> {} }:
-
-let
- sources = import ./nix/sources.nix;
- pkgs = import sources.nixpkgs {};
- rust = import ./nix/rust.nix { inherit sources; };
-in
-pkgs.mkShell {
- buildInputs = [
- pkgs.hello
- rust
-
- # keep this line if you use bash
- pkgs.bashInteractive
- ];
-}