mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 00:55:58 +08:00
Separate out the app
This commit is contained in:
parent
56e2b92633
commit
c3be5b79ce
2 changed files with 35 additions and 30 deletions
32
activate.nix
Normal file
32
activate.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# A rough flake-parts module for activating the system
|
||||
#
|
||||
# TODO: Replace with deploy-rs or (new) nixinate
|
||||
{ self, inputs, ... }:
|
||||
{
|
||||
perSystem = { system, pkgs, lib, ... }: {
|
||||
apps.default =
|
||||
let
|
||||
# Create a flake app that wraps the given bash CLI.
|
||||
bashCmdApp = name: cmd: {
|
||||
type = "app";
|
||||
program =
|
||||
(pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
text = ''
|
||||
set -x
|
||||
${cmd}
|
||||
'';
|
||||
}) + "/bin/${name}";
|
||||
};
|
||||
in
|
||||
if system == "aarch64-darwin" then
|
||||
bashCmdApp "darwin" ''
|
||||
${self.darwinConfigurations.default.system}/sw/bin/darwin-rebuild \
|
||||
switch --flake ${self}#default
|
||||
''
|
||||
else
|
||||
bashCmdApp "linux" ''
|
||||
${lib.getExe pkgs.nixos-rebuild} --use-remote-sudo switch -j auto
|
||||
'';
|
||||
};
|
||||
}
|
||||
33
flake.nix
33
flake.nix
|
|
@ -36,40 +36,13 @@
|
|||
./home
|
||||
./nixos
|
||||
./nix-darwin
|
||||
./activate.nix
|
||||
];
|
||||
perSystem = { self', inputs', config, pkgs, lib, system, ... }: {
|
||||
perSystem = { pkgs, ... }: {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
nixpkgs-fmt
|
||||
# To enable webhint to analyze source files
|
||||
nodejs
|
||||
];
|
||||
buildInputs = [ pkgs.nixpkgs-fmt ];
|
||||
};
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
apps.default =
|
||||
let
|
||||
# Create a flake app that wraps the given bash CLI.
|
||||
bashCmdApp = name: cmd: {
|
||||
type = "app";
|
||||
program =
|
||||
(pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
text = ''
|
||||
set -x
|
||||
${cmd}
|
||||
'';
|
||||
}) + "/bin/${name}";
|
||||
};
|
||||
in
|
||||
if system == "aarch64-darwin" then
|
||||
bashCmdApp "darwin" ''
|
||||
${self.darwinConfigurations.default.system}/sw/bin/darwin-rebuild \
|
||||
switch --flake ${self}#default
|
||||
''
|
||||
else
|
||||
bashCmdApp "linux" ''
|
||||
${lib.getExe pkgs.nixos-rebuild} --use-remote-sudo switch -j auto
|
||||
'';
|
||||
};
|
||||
flake =
|
||||
let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue