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
|
||||
|
||||
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`.
|
||||
`nix flake update --commit-lock-file`
|
|
@ -14,7 +14,6 @@
|
|||
netcat # <3
|
||||
|
||||
# used for nix config
|
||||
npins
|
||||
colmena
|
||||
agenix
|
||||
];
|
||||
|
|
18
flake.lock
18
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": {
|
||||
|
|
24
flake.nix
24
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,22 +33,17 @@
|
|||
nixpkgs.flake.source = nixpkgs;
|
||||
nix.nixPath = [ "nixpkgs=flake:nixpkgs" ];
|
||||
|
||||
nixpkgs.config = {
|
||||
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;
|
||||
});
|
||||
packageOverrides = pkgs: {
|
||||
agenix = agenix.packages.${config.nixpkgs.hostPlatform.system}.default;
|
||||
};
|
||||
};
|
||||
|
||||
overlays = [ nur.overlay ];
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useUserPackages = true;
|
||||
useGlobalPkgs = true;
|
||||
|
@ -54,6 +51,7 @@
|
|||
|
||||
imports = [
|
||||
home-manager.nixosModules.home-manager
|
||||
nur.nixosModules.nur
|
||||
agenix.nixosModules.default
|
||||
birdsong.nixosModules.default
|
||||
./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