update nix-darwin to be flake-based
This commit is contained in:
parent
ddc8c7ec80
commit
659a4f29bc
4 changed files with 144 additions and 17 deletions
5
nix/system/worktop/README.md
Normal file
5
nix/system/worktop/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Symlink the flake file into `/etc/nix-darwin/flake.nix` before initializing the
|
||||||
|
system!
|
||||||
|
|
||||||
|
You'll also need to populate the hostname in a `secret-variables.nix` file with
|
||||||
|
the output of `scutil --get LocalHostName`
|
||||||
|
|
@ -62,8 +62,8 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ <home-manager/nix-darwin> ];
|
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
# List packages installed in system profile. To search by name, run:
|
# List packages installed in system profile. To search by name, run:
|
||||||
# $ nix-env -qaP | grep wget
|
# $ nix-env -qaP | grep wget
|
||||||
|
|
@ -73,10 +73,10 @@ in
|
||||||
pkgs.obsidian
|
pkgs.obsidian
|
||||||
pkgs.syncthing
|
pkgs.syncthing
|
||||||
pkgs.slack
|
pkgs.slack
|
||||||
pkgs._1password
|
pkgs._1password-cli
|
||||||
# pkgs._1password-gui
|
pkgs._1password-gui
|
||||||
pkgs.tailscale
|
pkgs.tailscale
|
||||||
whatsapp
|
#whatsapp
|
||||||
obs-studio
|
obs-studio
|
||||||
vlc
|
vlc
|
||||||
keycastr
|
keycastr
|
||||||
|
|
@ -99,16 +99,9 @@ in
|
||||||
# have to do this to play nicely with home-manager:
|
# have to do this to play nicely with home-manager:
|
||||||
# https://github.com/nix-community/home-manager/issues/4026
|
# https://github.com/nix-community/home-manager/issues/4026
|
||||||
users.users.haak.home = "/Users/haak/";
|
users.users.haak.home = "/Users/haak/";
|
||||||
home-manager.users.haak.imports = [
|
|
||||||
../../home/commandline.nix
|
|
||||||
../../home/programs/alacritty
|
|
||||||
];
|
|
||||||
|
|
||||||
# nix.package = pkgs.nix;
|
|
||||||
|
|
||||||
# Create /etc/bashrc that loads the nix-darwin environment.
|
# Create /etc/bashrc that loads the nix-darwin environment.
|
||||||
programs.zsh.enable = true; # default shell on catalina
|
programs.zsh.enable = true; # default shell on catalina
|
||||||
# programs.fish.enable = true;
|
|
||||||
|
|
||||||
system.primaryUser = "haak";
|
system.primaryUser = "haak";
|
||||||
|
|
||||||
|
|
@ -116,12 +109,14 @@ in
|
||||||
# by nix-darwin
|
# by nix-darwin
|
||||||
system.activationScripts.applications.text = pkgs.lib.mkForce (
|
system.activationScripts.applications.text = pkgs.lib.mkForce (
|
||||||
''
|
''
|
||||||
userDir="$HOME/Applications/Nix Apps"
|
userDir="${config.users.users.haak.home}Applications/Nix Apps"
|
||||||
echo "setting up $userDir"
|
echo "setting up $userDir"
|
||||||
rm -rf $userDir
|
rm -rf "$userDir"
|
||||||
mkdir -p $userDir
|
mkdir -p "$userDir"
|
||||||
chown haak $userDir
|
chown haak "$userDir"
|
||||||
for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do
|
find ${config.system.build.applications}/Applications -maxdepth 1 -type l -exec sh -c '
|
||||||
|
userDir="${config.users.users.haak.home}Applications/Nix Apps"
|
||||||
|
app=$1
|
||||||
src="$(/usr/bin/stat -f%Y "$app")"
|
src="$(/usr/bin/stat -f%Y "$app")"
|
||||||
dst="$userDir/$(basename $src)"
|
dst="$userDir/$(basename $src)"
|
||||||
echo "app: $app, src: $src, dst: $dst"
|
echo "app: $app, src: $src, dst: $dst"
|
||||||
|
|
@ -129,7 +124,7 @@ in
|
||||||
echo "Linking $app"
|
echo "Linking $app"
|
||||||
ln -s "$app" "$dst"
|
ln -s "$app" "$dst"
|
||||||
fi
|
fi
|
||||||
done
|
' sh {} \;
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -262,4 +257,7 @@ in
|
||||||
# Used for backwards compatibility, please read the changelog before changing.
|
# Used for backwards compatibility, please read the changelog before changing.
|
||||||
# $ darwin-rebuild changelog
|
# $ darwin-rebuild changelog
|
||||||
system.stateVersion = 4;
|
system.stateVersion = 4;
|
||||||
|
|
||||||
|
# something odd about the migration from 4 to 5, or to Lix?
|
||||||
|
ids.gids.nixbld = 350;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
83
nix/system/worktop/flake.lock
generated
Normal file
83
nix/system/worktop/flake.lock
generated
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774379316,
|
||||||
|
"narHash": "sha256-0nGNxWDUH2Hzlj/R3Zf4FEK6fsFNB/dvewuboSRZqiI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "1eb0549a1ab3fe3f5acf86668249be15fa0e64f7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1773000227,
|
||||||
|
"narHash": "sha256-zm3ftUQw0MPumYi91HovoGhgyZBlM4o3Zy0LhPNwzXE=",
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "da529ac9e46f25ed5616fd634079a5f3c579135f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774218495,
|
||||||
|
"narHash": "sha256-5g/jjDqSwZ0cbUpUTJ/ip/otL3P7O9Q6fUg3Z3eBKt4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "03e95ed5e97dce71ef304ef35954593dd988e4b6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"variables": "variables"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"path": "./secret-variables.nix",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"path": "./secret-variables.nix",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"parent": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
41
nix/system/worktop/flake.nix
Normal file
41
nix/system/worktop/flake.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
description = "Worktop darwin system";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
|
||||||
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
variables = {
|
||||||
|
url = "./secret-variables.nix";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, variables }:
|
||||||
|
let
|
||||||
|
vars = import variables;
|
||||||
|
in {
|
||||||
|
darwinConfigurations."${vars.hostname}" = nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
./darwin-configuration.nix
|
||||||
|
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.haak = {
|
||||||
|
imports = [
|
||||||
|
../../home/commandline.nix
|
||||||
|
../../home/programs/alacritty
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue