feat: packages

This commit is contained in:
Philipp Hochkamp 2022-03-05 12:34:52 +01:00
parent 39f91ed113
commit 40f300f95a
7 changed files with 33 additions and 1 deletions

View file

@ -50,6 +50,9 @@
overlays = [
self.overlay
neovim-nightly-overlay.overlay
(final: prev: {
my = self.packages.${prev.system};
})
];
};
@ -130,5 +133,10 @@
daedalus = darwinSystem "aarch64-darwin" [ ./hosts/daedalus/default.nix ]; # TODO
};
};
} // utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [lefthook nixpkgs-fmt];
};
packages = lib.my.mapModules ./packages (p: pkgs.callPackage p { inputs = inputs;});
});
}

View file

@ -2,6 +2,7 @@
{
home.packages = with pkgs; [
my.scripts
nnn
bat
htop

0
packages/.gitkeep Normal file
View file

9
packages/scripts.nix Normal file
View file

@ -0,0 +1,9 @@
{ stdenv, ...}:
stdenv.mkDerivation {
name = "scripts";
src = ./scripts;
installPhase = ''
mkdir -p $out/bin
cp * $out/bin
'';
}

8
packages/scripts/nosrebuild Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
REV=$(curl https://api.github.com/repos/ragon000/nixos-config/branches/main | jq -r .commit.sha)
if [[ $(uname) == "Linux" ]]; then
sudo nixos-rebuild switch --flake "github:ragon000/nixos-config?rev=$REV"
else # Darwin
/nix/var/nix/profiles/system/sw/bin/darwin-rebuild switch --flake "github:ragon000/nixos-config?rev=$REV"
fi

3
packages/scripts/nr Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
nix run nixpkgs#$1

3
packages/scripts/ns Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
nix shell nixpkgs#$1