mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50:19 +00:00
remove flake-utils from the flake inputs
As requested in <https://todo.sr.ht/~soywod/pimalaya/131> I removed flake-utils. This reduces the number of flake inputs and doesn't add much code. The way this works, is that instead of `eachDefaultSystem` we have a function `forEachSupportedSystem`, this function generates an attrset with a key for each system in the `supportedSystems` array, whose value is the result of calling the provided function with the system as an argument: ```nix repl repl> forEachSupportedSystem f { "x86_64-linux" = f "x86_64-linux"; ... } ``` This is slightly clumsier than `flake-utils.lib.eachDefaultSystem`, which rewrites the returned attrset, but it is much less code and simpler to understand. I tested the build with `nix build` on `x86_64-linux` and it still works c:
This commit is contained in:
parent
da49352d4e
commit
ed5407a5c7
2 changed files with 15 additions and 46 deletions
34
flake.lock
34
flake.lock
|
@ -37,24 +37,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705309234,
|
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -115,7 +97,6 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"naersk": "naersk",
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
|
@ -137,21 +118,6 @@
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
27
flake.nix
27
flake.nix
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
gitignore = {
|
gitignore = {
|
||||||
url = "github:hercules-ci/gitignore.nix";
|
url = "github:hercules-ci/gitignore.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
@ -22,7 +21,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, gitignore, fenix, naersk, ... }:
|
outputs = { self, nixpkgs, gitignore, fenix, naersk, ... }:
|
||||||
let
|
let
|
||||||
inherit (gitignore.lib) gitignoreSource;
|
inherit (gitignore.lib) gitignoreSource;
|
||||||
|
|
||||||
|
@ -116,10 +115,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkApp = drv: flake-utils.lib.mkApp {
|
mkApp = drv:
|
||||||
inherit drv;
|
let exePath = drv.passthru.exePath or "/bin/himalaya";
|
||||||
name = "himalaya";
|
in
|
||||||
};
|
{
|
||||||
|
type = "app";
|
||||||
|
program = "${drv}${exePath}";
|
||||||
|
};
|
||||||
|
|
||||||
mkApps = buildPlatform:
|
mkApps = buildPlatform:
|
||||||
let
|
let
|
||||||
|
@ -141,11 +143,12 @@
|
||||||
in
|
in
|
||||||
mkApp app;
|
mkApp app;
|
||||||
};
|
};
|
||||||
|
supportedSystems = [ "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
|
||||||
|
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems f;
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (system: {
|
{
|
||||||
devShells = mkDevShells system;
|
apps = forEachSupportedSystem mkApps;
|
||||||
packages = mkPackages system;
|
packages = forEachSupportedSystem mkPackages;
|
||||||
apps = mkApps system;
|
devShells = forEachSupportedSystem mkDevShells;
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue