mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 07:04:47 +00:00
dawin/linux
This commit is contained in:
parent
5cdf8fd873
commit
1e4caa255f
6 changed files with 20 additions and 19 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
## Layout
|
## Layout
|
||||||
|
|
||||||
- `flake.nix`: top-level flake and host wiring
|
- `flake.nix`: top-level flake and host wiring
|
||||||
- `hosts/hari-macbook-pro/default.nix`: this machine's host config
|
- `hosts/darwin/default.nix`: macOS nix-darwin host config
|
||||||
- `hosts/workstation/default.nix`: standalone Linux Home Manager host config
|
- `hosts/linux/default.nix`: standalone Linux Home Manager host config
|
||||||
- `modules/base.nix`: Nix settings and core packages
|
- `modules/base.nix`: Nix settings and core packages
|
||||||
- `modules/macos.nix`: macOS defaults and host-level settings
|
- `modules/macos.nix`: macOS defaults and host-level settings
|
||||||
- `modules/packages.nix`: system packages and fonts
|
- `modules/packages.nix`: system packages and fonts
|
||||||
|
|
|
||||||
19
flake.nix
19
flake.nix
|
|
@ -41,8 +41,9 @@
|
||||||
darwinSystem = "aarch64-darwin";
|
darwinSystem = "aarch64-darwin";
|
||||||
linuxSystem = "x86_64-linux";
|
linuxSystem = "x86_64-linux";
|
||||||
username = "rathi";
|
username = "rathi";
|
||||||
darwinHostname = "hari-macbook-pro";
|
darwinConfigName = "darwin";
|
||||||
linuxHostname = "workstation";
|
darwinMachineHostname = "hari-macbook-pro";
|
||||||
|
linuxConfigName = "linux";
|
||||||
darwinPkgs = import nixpkgs {system = darwinSystem;};
|
darwinPkgs = import nixpkgs {system = darwinSystem;};
|
||||||
linuxPkgs = import nixpkgs {
|
linuxPkgs = import nixpkgs {
|
||||||
system = linuxSystem;
|
system = linuxSystem;
|
||||||
|
|
@ -52,14 +53,14 @@
|
||||||
formatter.${darwinSystem} = darwinPkgs.alejandra;
|
formatter.${darwinSystem} = darwinPkgs.alejandra;
|
||||||
formatter.${linuxSystem} = linuxPkgs.alejandra;
|
formatter.${linuxSystem} = linuxPkgs.alejandra;
|
||||||
|
|
||||||
darwinConfigurations.${darwinHostname} = nix-darwin.lib.darwinSystem {
|
darwinConfigurations.${darwinConfigName} = nix-darwin.lib.darwinSystem {
|
||||||
system = darwinSystem;
|
system = darwinSystem;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs self username;
|
inherit inputs self username;
|
||||||
hostname = darwinHostname;
|
hostname = darwinMachineHostname;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/${darwinHostname}
|
./hosts/${darwinConfigName}
|
||||||
home-manager.darwinModules.home-manager
|
home-manager.darwinModules.home-manager
|
||||||
nix-homebrew.darwinModules.nix-homebrew
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
{
|
{
|
||||||
|
|
@ -69,7 +70,7 @@
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.extraSpecialArgs = {
|
home-manager.extraSpecialArgs = {
|
||||||
inherit inputs self username;
|
inherit inputs self username;
|
||||||
hostname = darwinHostname;
|
hostname = darwinMachineHostname;
|
||||||
};
|
};
|
||||||
home-manager.backupFileExtension = "hm-bak";
|
home-manager.backupFileExtension = "hm-bak";
|
||||||
home-manager.users.${username} = import ./home;
|
home-manager.users.${username} = import ./home;
|
||||||
|
|
@ -84,14 +85,14 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
homeConfigurations.${linuxHostname} = home-manager.lib.homeManagerConfiguration {
|
homeConfigurations.${linuxConfigName} = home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = linuxPkgs;
|
pkgs = linuxPkgs;
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs self username;
|
inherit inputs self username;
|
||||||
hostname = linuxHostname;
|
hostname = linuxConfigName;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/${linuxHostname}
|
./hosts/${linuxConfigName}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,12 @@
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs pkgs.stdenv.isDarwin {
|
// lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||||
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
|
||||||
nrb = "sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#hari-macbook-pro"; # nrb - rebuild declarative config
|
nrb = "sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#darwin"; # nrb - rebuild declarative config
|
||||||
nup = "nix flake update $HOME/Documents/GitHub/nix && sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#hari-macbook-pro"; # nup - update flake + rebuild
|
nup = "nix flake update $HOME/Documents/GitHub/nix && sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#darwin"; # nup - update flake + rebuild
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs pkgs.stdenv.isLinux {
|
// lib.optionalAttrs pkgs.stdenv.isLinux {
|
||||||
nrb = "nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#workstation -b hm-bak"; # nrb - rebuild declarative config
|
nrb = "nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#linux -b hm-bak"; # nrb - rebuild declarative config
|
||||||
nup = "nix flake update $HOME/Documents/GitHub/nix && nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#workstation -b hm-bak"; # nup - update flake + rebuild
|
nup = "nix flake update $HOME/Documents/GitHub/nix && nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#linux -b hm-bak"; # nup - update flake + rebuild
|
||||||
};
|
};
|
||||||
|
|
||||||
envExtra =
|
envExtra =
|
||||||
|
|
|
||||||
8
justfile
8
justfile
|
|
@ -4,17 +4,17 @@ default:
|
||||||
check:
|
check:
|
||||||
nix --extra-experimental-features 'nix-command flakes' flake check
|
nix --extra-experimental-features 'nix-command flakes' flake check
|
||||||
|
|
||||||
build config='hari-macbook-pro':
|
build config='darwin':
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [[ "{{config}}" == "hari-macbook-pro" ]]; then
|
if [[ "{{config}}" == "darwin" ]]; then
|
||||||
nix --extra-experimental-features 'nix-command flakes' build path:.#darwinConfigurations.{{config}}.system
|
nix --extra-experimental-features 'nix-command flakes' build path:.#darwinConfigurations.{{config}}.system
|
||||||
else
|
else
|
||||||
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/home-manager -- build --flake path:.#{{config}}
|
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/home-manager -- build --flake path:.#{{config}}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
switch config='hari-macbook-pro':
|
switch config='darwin':
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [[ "{{config}}" == "hari-macbook-pro" ]]; then
|
if [[ "{{config}}" == "darwin" ]]; then
|
||||||
sudo env PATH="$PATH" nix --extra-experimental-features 'nix-command flakes' run github:LnL7/nix-darwin/master#darwin-rebuild -- switch --flake path:.#{{config}}
|
sudo env PATH="$PATH" nix --extra-experimental-features 'nix-command flakes' run github:LnL7/nix-darwin/master#darwin-rebuild -- switch --flake path:.#{{config}}
|
||||||
else
|
else
|
||||||
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/home-manager -- switch --flake path:.#{{config}} -b hm-bak
|
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/home-manager -- switch --flake path:.#{{config}} -b hm-bak
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue