Add link and unlink apps
This commit is contained in:
parent
a30c45c01d
commit
0055f4c9b3
17
flake.nix
17
flake.nix
@ -35,7 +35,7 @@
|
|||||||
let
|
let
|
||||||
inherit (builtins) mapAttrs attrValues;
|
inherit (builtins) mapAttrs attrValues;
|
||||||
inherit (lib.flake) eachDefaultSystem;
|
inherit (lib.flake) eachDefaultSystem;
|
||||||
inherit (lib.my) mkApp mkShellApp inlineModules mkDefaultSystemsPkgs flakePackageOverlay;
|
inherit (lib.my) mkApp mkShellApp mkShellApp' inlineModules mkDefaultSystemsPkgs flakePackageOverlay;
|
||||||
|
|
||||||
extendLib = lib: lib.extend (final: prev: {
|
extendLib = lib: lib.extend (final: prev: {
|
||||||
my = import ./util.nix { lib = final; };
|
my = import ./util.nix { lib = final; };
|
||||||
@ -108,6 +108,8 @@
|
|||||||
} //
|
} //
|
||||||
(eachDefaultSystem (system:
|
(eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
|
homeFlake = "$HOME/.config/nixpkgs/flake.nix";
|
||||||
|
|
||||||
pkgs = pkgs'.unstable.${system};
|
pkgs = pkgs'.unstable.${system};
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
in
|
in
|
||||||
@ -115,6 +117,19 @@
|
|||||||
{
|
{
|
||||||
apps = {
|
apps = {
|
||||||
fmt = mkShellApp pkgs "fmt" ''exec "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" "$@" .'';
|
fmt = mkShellApp pkgs "fmt" ''exec "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" "$@" .'';
|
||||||
|
link = mkShellApp' pkgs {
|
||||||
|
name = "install-home-link";
|
||||||
|
runtimeInputs = [ pkgs.coreutils ];
|
||||||
|
text =
|
||||||
|
''
|
||||||
|
[ -e "${homeFlake}" ] && echo "${homeFlake} already exists" && exit 1
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "${homeFlake}")"
|
||||||
|
ln -s "$(pwd)/flake.nix" "${homeFlake}"
|
||||||
|
echo "Installed link to $(pwd)/flake.nix at ${homeFlake}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
unlink = mkShellApp pkgs "remove-home-link" ''rm -f ${homeFlake}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
|
@ -14,6 +14,10 @@ mkMerge [
|
|||||||
enable = true;
|
enable = true;
|
||||||
settings = {};
|
settings = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lsd = {
|
||||||
|
enable = mkDefault true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
|
4
util.nix
4
util.nix
@ -24,6 +24,10 @@ rec {
|
|||||||
mkDefaultSystemsPkgs = path: args': genAttrs defaultSystems (system: import path ((args' system) // { inherit system; }));
|
mkDefaultSystemsPkgs = path: args': genAttrs defaultSystems (system: import path ((args' system) // { inherit system; }));
|
||||||
mkApp = program: { type = "app"; inherit program; };
|
mkApp = program: { type = "app"; inherit program; };
|
||||||
mkShellApp = pkgs: name: text: mkApp (pkgs.writeShellScript name text).outPath;
|
mkShellApp = pkgs: name: text: mkApp (pkgs.writeShellScript name text).outPath;
|
||||||
|
mkShellApp' = pkgs: args:
|
||||||
|
let
|
||||||
|
app = pkgs.writeShellApplication args;
|
||||||
|
in mkApp "${app}/bin/${app.meta.mainProgram}";
|
||||||
inlineModules = modules: mapAttrs
|
inlineModules = modules: mapAttrs
|
||||||
(_: path:
|
(_: path:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user