try out styx as a main repo

This commit is contained in:
Daylin Morgan 2024-01-24 14:12:52 -06:00
parent d8972aae6c
commit 67995c0c8f
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
4 changed files with 14 additions and 11 deletions

View file

@ -23,8 +23,11 @@
...
}: let
lib = import ./lib {inherit inputs nixpkgs;};
inherit (lib) findModules nixpkgsFor mapHosts;
inherit (builtins) listToAttrs readFile;
in {
nixosModules = builtins.listToAttrs (lib.findModules ./modules);
nixosConfigurations = lib.mapHosts ./hosts;
nixosModules = listToAttrs (findModules ./modules);
nixosConfigurations = mapHosts ./hosts;
packages.x86_64-linux.styx = (nixpkgsFor "x86_64-linux").writeScriptBin "styx" (readFile ./styx);
};
}

View file

@ -7,6 +7,8 @@
inherit (nixpkgs.lib) hasSuffix nixosSystem;
inherit (nixpkgs.lib.filesystem) listFilesRecursive;
in rec {
nixpkgsFor = system: import nixpkgs {inherit system;};
isNixFile = path: hasSuffix ".nix" path;
mkSystem = hostname:

View file

@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
(writeScriptBin "styx" (builtins.readFile ./styx))
];
}

View file

@ -5,7 +5,7 @@ set -e
# rewrite as python script?
HOSTNAME=${HOSTNAME:-$(hostname)}
FLAKE_PATH=${FLAKE_PATH-:$HOME/nixcfg}
FLAKE_PATH=${FLAKE_PATH:-$HOME/nixcfg}
DIM="$(tput dim)"
BOLD="$(tput bold)"
@ -30,7 +30,6 @@ styx <cmd> [-h]
${DIM}sister moon to nix on pluto
sister software to nix in this repo${RESET}
pass additional args with -- --key value
${BOLD}commands${RESET}:
EOF
printf "${GREEN}%8s${RESET} | ${YELLOW}%s${RESET}\n" \
@ -38,7 +37,8 @@ EOF
build "build and monitor with nom" \
boot "evaluate flake for next boot" \
switch "perform nixos rebuild" \
store "run some store cleanup"
store "run some store cleanup" \
cache "nix build and push to daylin.cachix.org"
exit
}
@ -100,6 +100,10 @@ while [[ $# -gt 0 ]]; do
--help)
help
;;
--)
shift
break
;;
-*,--*)
error "unknown flag: ${BOLD}$1${RESET}"
exit 1
@ -116,5 +120,4 @@ if [[ $# -gt 0 ]]; then
fi
$cmd "$@"