entirely migrate from npins to flake inputs
This commit is contained in:
parent
6d83a07556
commit
b4b879a87b
|
@ -29,8 +29,4 @@ To build the remote machines, run `colmena apply`. See the [colmena documentatio
|
||||||
|
|
||||||
### Updating
|
### Updating
|
||||||
|
|
||||||
Run `nix flake update` to update evaluation-time dependencies.
|
`nix flake update --commit-lock-file`
|
||||||
|
|
||||||
Run `npins update` to update build-time dependencies.
|
|
||||||
|
|
||||||
Commit changes to `flake.lock` and `npins/sources.json`.
|
|
|
@ -14,7 +14,6 @@
|
||||||
netcat # <3
|
netcat # <3
|
||||||
|
|
||||||
# used for nix config
|
# used for nix config
|
||||||
npins
|
|
||||||
colmena
|
colmena
|
||||||
agenix
|
agenix
|
||||||
];
|
];
|
||||||
|
|
18
flake.lock
18
flake.lock
|
@ -97,12 +97,28 @@
|
||||||
"type": "github"
|
"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": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
"birdsong": "birdsong",
|
"birdsong": "birdsong",
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nur": "nur"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|
26
flake.nix
26
flake.nix
|
@ -7,6 +7,8 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nur.url = "github:nix-community/NUR";
|
||||||
|
|
||||||
agenix = {
|
agenix = {
|
||||||
url = "github:ryantm/agenix?tag=0.15.0";
|
url = "github:ryantm/agenix?tag=0.15.0";
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
birdsong.url = "git+https://git.qenya.tel/qenya/birdsong?ref=main";
|
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 = {
|
colmena = {
|
||||||
meta.nixpkgs = import nixpkgs { system = "x86_64-linux"; };
|
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
|
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;
|
nixpkgs.flake.source = nixpkgs;
|
||||||
nix.nixPath = [ "nixpkgs=flake:nixpkgs" ];
|
nix.nixPath = [ "nixpkgs=flake:nixpkgs" ];
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs = {
|
||||||
allowUnfree = true;
|
config = {
|
||||||
packageOverrides = pkgs:
|
allowUnfree = true;
|
||||||
let
|
packageOverrides = pkgs: {
|
||||||
sources = import ./npins;
|
agenix = agenix.packages.${config.nixpkgs.hostPlatform.system}.default;
|
||||||
inherit (config.nixpkgs.hostPlatform) system;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
agenix = agenix.packages.${system}.default;
|
|
||||||
nur = (import sources.nur {
|
|
||||||
nurpkgs = pkgs;
|
|
||||||
inherit pkgs;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
overlays = [ nur.overlay ];
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
@ -54,6 +51,7 @@
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
nur.nixosModules.nur
|
||||||
agenix.nixosModules.default
|
agenix.nixosModules.default
|
||||||
birdsong.nixosModules.default
|
birdsong.nixosModules.default
|
||||||
./common
|
./common
|
||||||
|
|
|
@ -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`"
|
|
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in a new issue