diff --git a/README.md b/README.md index e4a39d7..bed7956 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,4 @@ To build the remote machines, run `colmena apply`. See the [colmena documentatio ### Updating -Run `nix flake update` to update evaluation-time dependencies. - -Run `npins update` to update build-time dependencies. - -Commit changes to `flake.lock` and `npins/sources.json`. \ No newline at end of file +`nix flake update --commit-lock-file` \ No newline at end of file diff --git a/common/environment.nix b/common/environment.nix index 857dce4..433a2a9 100644 --- a/common/environment.nix +++ b/common/environment.nix @@ -14,7 +14,6 @@ netcat # <3 # used for nix config - npins colmena agenix ]; diff --git a/flake.lock b/flake.lock index 8e6749e..0c14db5 100644 --- a/flake.lock +++ b/flake.lock @@ -97,12 +97,28 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1724921284, + "narHash": "sha256-mHV9kKOufZMjHSaL+uQ71UfrNqFd50THiNWesfBf9Kk=", + "owner": "nix-community", + "repo": "NUR", + "rev": "0891674223deb1262d8a96a46598fca0840c8271", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "birdsong": "birdsong", "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nur": "nur" } }, "systems": { diff --git a/flake.nix b/flake.nix index 0c04f89..a262ee5 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nur.url = "github:nix-community/NUR"; + agenix = { url = "github:ryantm/agenix?tag=0.15.0"; inputs = { @@ -18,7 +20,7 @@ birdsong.url = "git+https://git.qenya.tel/qenya/birdsong?ref=main"; }; - outputs = inputs@{ self, nixpkgs, home-manager, agenix, birdsong, ... }: { + outputs = inputs@{ self, nixpkgs, home-manager, nur, agenix, birdsong, ... }: { colmena = { meta.nixpkgs = import nixpkgs { system = "x86_64-linux"; }; meta.nodeNixpkgs.kalessin = import nixpkgs { system = "aarch64-linux"; }; # TODO: this should be generated from the host config somehow @@ -31,20 +33,15 @@ nixpkgs.flake.source = nixpkgs; nix.nixPath = [ "nixpkgs=flake:nixpkgs" ]; - nixpkgs.config = { - allowUnfree = true; - packageOverrides = pkgs: - let - sources = import ./npins; - inherit (config.nixpkgs.hostPlatform) system; - in - { - agenix = agenix.packages.${system}.default; - nur = (import sources.nur { - nurpkgs = pkgs; - inherit pkgs; - }); + nixpkgs = { + config = { + allowUnfree = true; + packageOverrides = pkgs: { + agenix = agenix.packages.${config.nixpkgs.hostPlatform.system}.default; }; + }; + + overlays = [ nur.overlay ]; }; home-manager = { @@ -54,6 +51,7 @@ imports = [ home-manager.nixosModules.home-manager + nur.nixosModules.nur agenix.nixosModules.default birdsong.nixosModules.default ./common diff --git a/npins/default.nix b/npins/default.nix deleted file mode 100644 index 5e7d086..0000000 --- a/npins/default.nix +++ /dev/null @@ -1,80 +0,0 @@ -# Generated by npins. Do not modify; will be overwritten regularly -let - data = builtins.fromJSON (builtins.readFile ./sources.json); - version = data.version; - - mkSource = - spec: - assert spec ? type; - let - path = - if spec.type == "Git" then - mkGitSource spec - else if spec.type == "GitRelease" then - mkGitSource spec - else if spec.type == "PyPi" then - mkPyPiSource spec - else if spec.type == "Channel" then - mkChannelSource spec - else - builtins.throw "Unknown source type ${spec.type}"; - in - spec // { outPath = path; }; - - mkGitSource = - { - repository, - revision, - url ? null, - hash, - branch ? null, - ... - }: - assert repository ? type; - # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository - # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else - assert repository.type == "Git"; - let - urlToName = - url: rev: - let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url; - - short = builtins.substring 0 7 rev; - - appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; - in - "${if matched == null then "source" else builtins.head matched}${appendShort}"; - name = urlToName repository.url revision; - in - builtins.fetchGit { - url = repository.url; - rev = revision; - inherit name; - # hash = hash; - }; - - mkPyPiSource = - { url, hash, ... }: - builtins.fetchurl { - inherit url; - sha256 = hash; - }; - - mkChannelSource = - { url, hash, ... }: - builtins.fetchTarball { - inherit url; - sha256 = hash; - }; -in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins -else - throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json deleted file mode 100644 index 7110f10..0000000 --- a/npins/sources.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "pins": { - "nur": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "nix-community", - "repo": "NUR" - }, - "branch": "master", - "revision": "6cbb9fb9c5d55fa2af9a5b0d3185d56c90ad62aa", - "url": "https://github.com/nix-community/NUR/archive/6cbb9fb9c5d55fa2af9a5b0d3185d56c90ad62aa.tar.gz", - "hash": "1w1n56p4hbq1zlz8hiw3169kxsw4cn5maahlk8vdzprs498f69kg" - } - }, - "version": 3 -} \ No newline at end of file