This commit is contained in:
atagen 2024-08-28 14:23:28 +10:00
parent 914788cd30
commit 8003d9b2a6
10 changed files with 379 additions and 121 deletions

80
flakes/meat/flake.lock generated
View file

@ -36,11 +36,11 @@
"lix": {
"flake": false,
"locked": {
"lastModified": 1724058824,
"narHash": "sha256-WkRs8plqBYxIgrcz1jenmxbcLVVpo9Z9Waot9qIlqmI=",
"rev": "e727dbc3a3d59d7742a24a2b394b63a04ecb4d24",
"lastModified": 1724816427,
"narHash": "sha256-j/ma58x680RD8k9YGDGgj6qx/3b2qaZOBdyr0My7ik0=",
"rev": "5d31e889d7f3310cb030e85adcfd3ce64846457d",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/e727dbc3a3d59d7742a24a2b394b63a04ecb4d24.tar.gz?rev=e727dbc3a3d59d7742a24a2b394b63a04ecb4d24"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/5d31e889d7f3310cb030e85adcfd3ce64846457d.tar.gz?rev=5d31e889d7f3310cb030e85adcfd3ce64846457d"
},
"original": {
"type": "tarball",
@ -75,11 +75,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1723994268,
"narHash": "sha256-3nHuGGBTqUxy1g7sm+1zTNLxbz9fnMr1ZX9etCWlFG8=",
"lastModified": 1724689275,
"narHash": "sha256-wpxC7XiZ9maYZA4BSLKGXc+pn2fwaiq2Ybu5kNjl1ao=",
"owner": "viperML",
"repo": "nh",
"rev": "dd8bdc83cfd7d3a8c7167589a03577c21ea015d2",
"rev": "a922eada049854019c5d1bbc82383f7095773e5c",
"type": "github"
},
"original": {
@ -106,11 +106,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1723991338,
"narHash": "sha256-Grh5PF0+gootJfOJFenTTxDTYPidA3V28dqJ/WV7iis=",
"lastModified": 1724479785,
"narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8a3354191c0d7144db9756a74755672387b702ba",
"rev": "d0e1602ddde669d5beb01aec49d71a51937ed7be",
"type": "github"
},
"original": {
@ -119,6 +119,35 @@
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"path": "/nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1718428119,
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"lix": "lix",
@ -128,16 +157,35 @@
"src": "src"
}
},
"src": {
"flake": false,
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1,
"narHash": "sha256-+svCK6F/suBPZlpFhU+Tr62er7fIoCYLfF9nBjYQoog=",
"path": "src",
"lastModified": 1724466314,
"narHash": "sha256-ltKuK6shQ64uej1mYNtBsDYxttUNFiv9AcHqk0+0NQM=",
"path": "/nix/store/gsif96m93kai5bx7qi0v9f9451q1b1ai-source",
"rev": "2b5b3edd96ef336b00622dcabc13788fdef9e3ca",
"type": "path"
},
"original": {
"path": "src",
"id": "rust-overlay",
"type": "indirect"
}
},
"src": {
"inputs": {
"nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1724817482,
"narHash": "sha256-ZVu7hWi8u8roZkHOeRAkDMkXlyIHvoQgb6UTUfP+xyk=",
"path": "/home/bolt/code/meat",
"type": "path"
},
"original": {
"path": "/home/bolt/code/meat",
"type": "path"
}
},

View file

@ -17,10 +17,7 @@
inputs.lix.follows = "lix";
};
src = {
url = "path:src";
flake = false;
};
src.url = "path:/home/bolt/code/meat";
};
outputs = {
@ -31,52 +28,27 @@
src,
...
}: let
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [
lix-module.overlays.default
nh.overlays.default
];
});
pkgs = import nixpkgs {
overlays = [
lix-module.overlays.default
nh.overlays.default
];
system = "x86_64-linux";
};
in {
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
meat = pkgs.callPackage ./meat.nix {
inherit src;
};
});
# packages.meat = pkgs.callPackage ./meat.nix {
# inherit src;
# };
packages.meat = src.packages.x86_64-linux.default;
defaultPackage = forAllSystems (system: self.packages.${system}.meat);
defaultPackage = self.packages.meat;
nixosModules.meat = {
pkgs,
config,
...
}: {
options.programs.meat = with pkgs.lib; {
flake = mkOption {
type = with types; nullOr (either path str);
default = null;
description = "path to your system flake";
};
};
config = {
environment.systemPackages = [self.defaultPackage.${pkgs.system}];
environment.sessionVariables = let
cfg = config.programs.meat;
in {
FLAKE =
if (cfg.flake == null)
then throw "Please set the programs.meat.flake option to your system flake."
else config.programs.meat.flake;
};
};
overlays.meat = final: prev: {
meat = self.defaultPackage;
};
nixosModules.meat = import ./module.nix {
meatOverlay = self.overlays.meat;
};
};
}

View file

@ -0,0 +1,28 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkOption types;
cfg = config.programs.meat;
in {
options.programs.meat = {
enable = mkEnableOption "meat";
flake = mkOption {
type = with types; nullOr (either path str);
default = null;
description = "path to your system flake";
};
};
config =
lib.mkIf
cfg.enable
{
environment.systemPackages = [pkgs.meat];
environment.sessionVariables.FLAKE =
if (cfg.flake == null)
then abort "Please set the programs.meat.flake option to your system flake."
else config.programs.meat.flake;
};
}

4
flakes/meat/module.nix Normal file
View file

@ -0,0 +1,4 @@
{meatOverlay}: {
imports = [./meat-module.nix];
nixpkgs.overlays = [meatOverlay];
}

View file

@ -14,19 +14,28 @@ case $cmd in
;;
fresh)
if [[ "$1" == "-a" ]]; then
shift
all=true
else
all=false
fi
if [[ "${#@}" > 0 ]]; then
for f in $@; do
if [ -d "./flakes/$f" ]; then
printf "subflake: $f\n"
nix flake update --flake "./flakes/$f"
nix flake update $@
fi
done
else
elif $all; then
printf "updating all\n"
for f in ./flakes/*; do
printf "subflake: $f\n"
nix flake update --flake "$f"
done
nix flake update
fi
printf "updating system\n"
nix flake update
;;
gut)