mirror of
https://github.com/srid/nixos-config.git
synced 2025-12-26 23:14:57 +08:00
32 lines
893 B
Nix
32 lines
893 B
Nix
# 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
|
|
'';
|
|
};
|
|
}
|