Compare commits
57 commits
rebase/fla
...
prime
Author | SHA1 | Date | |
---|---|---|---|
609482e62c | |||
b0c6785f64 | |||
e3ad7a2528 | |||
ab627ac919 | |||
e02411d563 | |||
021dadfed8 | |||
084caa727b | |||
d9c41f1c61 | |||
06e7b69f99 | |||
96321d4026 | |||
399e049775 | |||
bee32b5b2b | |||
343f3d481f | |||
79b83cfc70 | |||
f502810dae | |||
fba46e0d0d | |||
ba4f32c4f9 | |||
359707ffee | |||
e72a8a0586 | |||
bebc1ed649 | |||
59fb406eb9 | |||
750f2efaa7 | |||
346ad74c5d | |||
80c63d155d | |||
74dcb8fed0 | |||
42ef2d6c01 | |||
16d4a9e9d1 | |||
25cb9a6ff8 | |||
7866bc5bc7 | |||
e5e365a1e0 | |||
e9edf5ad55 | |||
50a183a040 | |||
40b45c6c78 | |||
003a676da0 | |||
7d9efe0b29 | |||
3f10cf6205 | |||
ee522765b7 | |||
3af11b2519 | |||
3d64bf5a6e | |||
cf6917e56d | |||
92e6da3645 | |||
0f3694c82d | |||
b085f92226 | |||
26e21a4edd | |||
331ab6a448 | |||
c1100a67eb | |||
a53868c454 | |||
9470ea2f90 | |||
65659908cf | |||
cd984132ee | |||
79eec8b971 | |||
1b3414549d | |||
45414c48b9 | |||
0f741cbb36 | |||
9cb4542b05 | |||
c21f7efecd | |||
cc08a506c8 |
37 changed files with 678 additions and 485 deletions
38
flake.lock
generated
38
flake.lock
generated
|
@ -337,6 +337,42 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"manifest": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752588656,
|
||||||
|
"narHash": "sha256-clKPzQ43eDpukeiGHzXmd1hGb2s4N+MWXAzQ5u5+pHQ=",
|
||||||
|
"owner": "rrvsh",
|
||||||
|
"repo": "manifest",
|
||||||
|
"rev": "365902fba994f30469298dee0c98a5fc0f41ec38",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rrvsh",
|
||||||
|
"repo": "manifest",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751313918,
|
||||||
|
"narHash": "sha256-HsJM3XLa43WpG+665aGEh8iS8AfEwOIQWk3Mke3e7nk=",
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "e04a388232d9a6ba56967ce5b53a8a6f713cdfcf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-index-database": {
|
"nix-index-database": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -467,6 +503,8 @@
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"import-tree": "import-tree",
|
"import-tree": "import-tree",
|
||||||
"make-shell": "make-shell",
|
"make-shell": "make-shell",
|
||||||
|
"manifest": "manifest",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nix-index-database": "nix-index-database",
|
"nix-index-database": "nix-index-database",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
|
|
14
flake.nix
14
flake.nix
|
@ -1,11 +1,14 @@
|
||||||
{
|
{
|
||||||
outputs =
|
outputs =
|
||||||
inputs:
|
{ self, ... }@inputs:
|
||||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
|
||||||
(inputs.import-tree ./nix)
|
(inputs.import-tree ./nix)
|
||||||
// {
|
// {
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
flake.paths.root = ./.;
|
flake = {
|
||||||
|
inherit self;
|
||||||
|
paths.root = ./.;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
inputs = {
|
inputs = {
|
||||||
|
@ -22,6 +25,11 @@
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
# nix darwin provides declarative mac configuration
|
||||||
|
nix-darwin = {
|
||||||
|
url = "github:nix-darwin/nix-darwin/master";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
# the nix user repository for mainly firefox extensions
|
# the nix user repository for mainly firefox extensions
|
||||||
nur = {
|
nur = {
|
||||||
url = "github:nix-community/NUR";
|
url = "github:nix-community/NUR";
|
||||||
|
@ -63,6 +71,8 @@
|
||||||
files.url = "github:mightyiam/files";
|
files.url = "github:mightyiam/files";
|
||||||
# text.nix lets us easily define markdown text to pass to files
|
# text.nix lets us easily define markdown text to pass to files
|
||||||
text.url = "github:rrvsh/text.nix";
|
text.url = "github:rrvsh/text.nix";
|
||||||
|
# manifest lets us define all hosts in one file
|
||||||
|
manifest.url = "github:rrvsh/manifest";
|
||||||
# make-shells.<name> creates devShells and checks
|
# make-shells.<name> creates devShells and checks
|
||||||
make-shell = {
|
make-shell = {
|
||||||
url = "github:nicknovitski/make-shell";
|
url = "github:nicknovitski/make-shell";
|
||||||
|
|
|
@ -6,28 +6,30 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) nixosSystem;
|
inherit (lib) nixosSystem;
|
||||||
|
inherit (inputs.nix-darwin.lib) darwinSystem;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) optional;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
inherit (cfg.lib.modules) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
|
inherit (config.manifest) hosts;
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
globalCfg = name: hostConfig: {
|
globalCfg = hostName: hostConfig: {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = { inherit hostName hostConfig; };
|
||||||
inherit hostConfig;
|
|
||||||
hostName = name;
|
|
||||||
};
|
|
||||||
sharedModules = [ cfg.modules.homeManager.default ];
|
sharedModules = [ cfg.modules.homeManager.default ];
|
||||||
users = forAllUsers' (name: _: cfg.modules.homeManager.${name});
|
users = forAllUsers' (name: _: cfg.modules.homeManager.${name});
|
||||||
};
|
};
|
||||||
hosts = cfg.manifest.hosts or { };
|
|
||||||
mkConfigurations =
|
mkConfigurations =
|
||||||
class: hosts:
|
class: hosts:
|
||||||
mapAttrs (
|
mapAttrs (
|
||||||
name: value:
|
name: value:
|
||||||
if class == "nixos" then
|
if class == "nixos" then
|
||||||
nixosSystem {
|
nixosSystem {
|
||||||
specialArgs.hostName = name;
|
specialArgs = {
|
||||||
|
inherit (config.flake) self;
|
||||||
|
hostName = name;
|
||||||
|
hostConfig = value;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
cfg.modules.nixos.default
|
cfg.modules.nixos.default
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
@ -35,6 +37,20 @@ let
|
||||||
(value.extraCfg or { })
|
(value.extraCfg or { })
|
||||||
] ++ optional value.graphical cfg.modules.nixos.graphical;
|
] ++ optional value.graphical cfg.modules.nixos.graphical;
|
||||||
}
|
}
|
||||||
|
else if class == "darwin" then
|
||||||
|
darwinSystem {
|
||||||
|
specialArgs = {
|
||||||
|
inherit (config.flake) self;
|
||||||
|
hostName = name;
|
||||||
|
hostConfig = value;
|
||||||
|
};
|
||||||
|
modules = [
|
||||||
|
cfg.modules.darwin.default
|
||||||
|
inputs.home-manager.darwinModules.home-manager
|
||||||
|
{ home-manager = globalCfg name value; }
|
||||||
|
(value.extraCfg or { })
|
||||||
|
] ++ optional value.graphical cfg.modules.darwin.graphical;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ }
|
{ }
|
||||||
) hosts;
|
) hosts;
|
||||||
|
@ -42,4 +58,5 @@ in
|
||||||
{
|
{
|
||||||
imports = [ inputs.home-manager.flakeModules.home-manager ];
|
imports = [ inputs.home-manager.flakeModules.home-manager ];
|
||||||
flake.nixosConfigurations = mkConfigurations "nixos" hosts.nixos;
|
flake.nixosConfigurations = mkConfigurations "nixos" hosts.nixos;
|
||||||
|
flake.darwinConfigurations = mkConfigurations "darwin" hosts.darwin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
parts."Structure" = # markdown
|
parts."Structure" = # markdown
|
||||||
''
|
''
|
||||||
The system configurations are defined in [`flake.manifest`](nix/manifest.nix).
|
The system configurations are defined in [`flake.manifest`](nix/manifest.nix).
|
||||||
`flake.manifest.owner` provides the attributes for the administrator user, including username and pubkey.
|
`manifest.owner` provides the attributes for the administrator user, including username and pubkey.
|
||||||
`flake.manifest.hosts` provides the specifications for the system configurations that should be exposed by the flake as nixosConfigurations.
|
`manifest.hosts` provides the specifications for the system configurations that should be exposed by the flake as nixosConfigurations.
|
||||||
`flake.modules.nixos.*` provide NixOS options and configurations.
|
`flake.modules.nixos.*` provide NixOS options and configurations.
|
||||||
The attribute `flake.modules.nixos.default` provides options that will be applied to every system of that class.
|
The attribute `flake.modules.nixos.default` provides options that will be applied to every system of that class.
|
||||||
You can use it as seen [here](nix/modules/flake/home-manager.nix):
|
You can use it as seen [here](nix/modules/flake/home-manager.nix):
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
debug = true;
|
|
||||||
}
|
|
10
nix/flake-parts/flake-parts.nix
Normal file
10
nix/flake-parts/flake-parts.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{ inputs, ... }:
|
||||||
|
{
|
||||||
|
debug = true;
|
||||||
|
imports = [
|
||||||
|
inputs.make-shell.flakeModules.default
|
||||||
|
inputs.manifest.flakeModules.default
|
||||||
|
inputs.flake-parts.flakeModules.modules
|
||||||
|
inputs.text.flakeModules.default
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
#TODO: add to readme
|
|
||||||
imports = [ inputs.make-shell.flakeModules.default ];
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
imports = [ inputs.flake-parts.flakeModules.modules ];
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
imports = [ inputs.text.flakeModules.default ];
|
|
||||||
}
|
|
|
@ -4,7 +4,8 @@
|
||||||
enableTreesitter = true;
|
enableTreesitter = true;
|
||||||
bash.enable = true;
|
bash.enable = true;
|
||||||
clang.enable = true;
|
clang.enable = true;
|
||||||
csharp.enable = true;
|
# broken on macos
|
||||||
|
# csharp.enable = true;
|
||||||
css.enable = true;
|
css.enable = true;
|
||||||
go.enable = true;
|
go.enable = true;
|
||||||
html.enable = true;
|
html.enable = true;
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
};
|
};
|
||||||
rust.enable = true;
|
rust.enable = true;
|
||||||
rust.crates.enable = true;
|
rust.crates.enable = true;
|
||||||
|
tailwind.enable = true;
|
||||||
ts.enable = true;
|
ts.enable = true;
|
||||||
ts.extensions.ts-error-translator.enable = true;
|
ts.extensions.ts-error-translator.enable = true;
|
||||||
typst.enable = true;
|
typst.enable = true;
|
||||||
|
|
21
nix/homes/rafiq/darwin.nix
Normal file
21
nix/homes/rafiq/darwin.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.homeManager.rafiq =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
hostName,
|
||||||
|
hostConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
mkIf (pkgs.system == "aarch64-darwin" || pkgs.system == "x86_64-darwin") {
|
||||||
|
home.file."Library/Application Support/aichat/config.yaml".text = ''
|
||||||
|
model: gemini:gemini-2.0-flash
|
||||||
|
clients:
|
||||||
|
- type: gemini
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -45,6 +45,7 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
programs = {
|
programs = {
|
||||||
|
mise.enable = true;
|
||||||
nvf.enable = true;
|
nvf.enable = true;
|
||||||
nvf.settings.vim = {
|
nvf.settings.vim = {
|
||||||
syntaxHighlighting = true;
|
syntaxHighlighting = true;
|
||||||
|
|
31
nix/homes/rafiq/desktop/darwin.nix
Normal file
31
nix/homes/rafiq/desktop/darwin.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
flake.modules.darwin.graphical.homebrew = {
|
||||||
|
brews = [
|
||||||
|
"mise"
|
||||||
|
"docker"
|
||||||
|
];
|
||||||
|
casks = [
|
||||||
|
"ghostty"
|
||||||
|
"slack"
|
||||||
|
"gitify"
|
||||||
|
"telegram"
|
||||||
|
"vial"
|
||||||
|
"linear-linear"
|
||||||
|
"chatgpt"
|
||||||
|
"spotify"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
flake.modules.homeManager.rafiq = {
|
||||||
|
# make sure brew is on the path for M1
|
||||||
|
programs.zsh.initContent = ''
|
||||||
|
if [[ $(uname -m) == 'arm64' ]]; then
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
programs.fish.shellInit = ''
|
||||||
|
if test (uname -m) = "arm64"
|
||||||
|
eval (/opt/homebrew/bin/brew shellenv)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,75 +1,9 @@
|
||||||
|
{ lib, inputs, ... }:
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.flake;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
allowedUnfreePackages = [
|
|
||||||
"stremio-shell"
|
|
||||||
"stremio-server"
|
|
||||||
"steam"
|
|
||||||
"steam-unwrapped"
|
|
||||||
];
|
|
||||||
flake.modules.nixos.graphical =
|
|
||||||
{ config, pkgs, ... }:
|
|
||||||
{
|
|
||||||
fonts.packages = [ pkgs.font-awesome ];
|
|
||||||
services.getty.autologinUser = cfg.admin.username;
|
|
||||||
# Start Hyprland at boot only if not connecting through SSH
|
|
||||||
environment.loginShellInit = # sh
|
|
||||||
''
|
|
||||||
if [[ -z "$SSH_CLIENT" && -z "$SSH_CONNECTION" ]]; then
|
|
||||||
if uwsm check may-start; then
|
|
||||||
exec uwsm start hyprland-uwsm.desktop
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
environment.variables = {
|
|
||||||
# Get Electron apps to use Wayland
|
|
||||||
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
|
||||||
NIXOS_OZONE_WL = "1";
|
|
||||||
};
|
|
||||||
programs = {
|
|
||||||
hyprland = {
|
|
||||||
enable = true;
|
|
||||||
# Use UWSM to have each process controlled by systemd init
|
|
||||||
withUWSM = true;
|
|
||||||
};
|
|
||||||
steam = {
|
|
||||||
enable = true;
|
|
||||||
gamescopeSession.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
security.pam.services.hyprlock = { };
|
|
||||||
services.sunshine = {
|
|
||||||
enable = true;
|
|
||||||
capSysAdmin = true;
|
|
||||||
openFirewall = true;
|
|
||||||
settings = {
|
|
||||||
sunshine_name = config.networking.hostName;
|
|
||||||
origin_pin_allowed = "wan";
|
|
||||||
origin_web_ui_allowed = "wan";
|
|
||||||
};
|
|
||||||
applications = { };
|
|
||||||
};
|
|
||||||
# spotifyd
|
|
||||||
networking.firewall.allowedTCPPorts = [ 5353 ];
|
|
||||||
networking.firewall.allowedUDPPorts = [ 5353 ];
|
|
||||||
};
|
|
||||||
flake.modules.homeManager.rafiq =
|
flake.modules.homeManager.rafiq =
|
||||||
{
|
{ pkgs, config, ... }:
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
hostName,
|
|
||||||
hostConfig,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
inherit (lib.modules) mkMerge mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (builtins) map listToAttrs;
|
inherit (builtins) map listToAttrs;
|
||||||
inherit (lib.lists) findFirstIndex;
|
inherit (lib.lists) findFirstIndex;
|
||||||
inherit (inputs.nur.legacyPackages.${pkgs.stdenv.hostPlatform.system}.repos.rycee) firefox-addons;
|
inherit (inputs.nur.legacyPackages.${pkgs.stdenv.hostPlatform.system}.repos.rycee) firefox-addons;
|
||||||
|
@ -104,185 +38,24 @@ in
|
||||||
targets = {
|
targets = {
|
||||||
firefox.colorTheme.enable = true;
|
firefox.colorTheme.enable = true;
|
||||||
firefox.profileNames = syncedProfiles;
|
firefox.profileNames = syncedProfiles;
|
||||||
waybar.addCss = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
persistDirs = [
|
|
||||||
"docs"
|
|
||||||
"repos"
|
|
||||||
"vids"
|
|
||||||
"tmp"
|
|
||||||
".cache/Smart Code ltd/Stremio"
|
|
||||||
".local/share/Smart Code ltd/Stremio"
|
|
||||||
".mozilla/firefox"
|
|
||||||
".tor project"
|
|
||||||
".local/share/Steam"
|
|
||||||
".local/share/PrismLauncher"
|
|
||||||
".config/sunshine"
|
|
||||||
];
|
|
||||||
home = {
|
home = {
|
||||||
packages = with pkgs; [
|
|
||||||
prismlauncher
|
|
||||||
stremio
|
|
||||||
tor-browser
|
|
||||||
vlc
|
|
||||||
wl-clipboard-rs
|
|
||||||
];
|
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
BROWSER = "firefox";
|
BROWSER = "firefox";
|
||||||
LAUNCHER = "fuzzel";
|
|
||||||
LOCKSCREEN = "hyprlock";
|
|
||||||
NOTIFICATION_DAEMON = "mako";
|
|
||||||
TERMINAL = "ghostty";
|
TERMINAL = "ghostty";
|
||||||
STATUS_BAR = "waybar";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
programs = {
|
programs = {
|
||||||
fuzzel.enable = true;
|
|
||||||
obs-studio.enable = true;
|
|
||||||
vesktop.enable = true;
|
vesktop.enable = true;
|
||||||
thunderbird.enable = true;
|
thunderbird.enable = true;
|
||||||
thunderbird.profiles.rafiq.isDefault = true;
|
thunderbird.profiles.rafiq.isDefault = true;
|
||||||
|
# ghostty is broken on nix-darwin
|
||||||
|
ghostty.settings.confirm-close-surface = false;
|
||||||
firefox = {
|
firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit profiles;
|
inherit profiles;
|
||||||
};
|
};
|
||||||
hyprlock = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
general.hide_cursor = true;
|
|
||||||
general.ignore_empty_input = true;
|
|
||||||
background.blur_passes = 5;
|
|
||||||
background.blur_size = 5;
|
|
||||||
label = {
|
|
||||||
text = ''hi, $USER.'';
|
|
||||||
font_size = 32;
|
|
||||||
position = "0, 0";
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
zindex = 1;
|
|
||||||
shadow_passes = 5;
|
|
||||||
shadow_size = 5;
|
|
||||||
};
|
};
|
||||||
input-field = {
|
|
||||||
placeholder_text = "";
|
|
||||||
fade_on_empty = true;
|
|
||||||
size = "200, 45";
|
|
||||||
position = "0, -5%";
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
zindex = 1;
|
|
||||||
shadow_passes = 5;
|
|
||||||
shadow_size = 5;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ghostty = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
confirm-close-surface = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
waybar = {
|
|
||||||
enable = true;
|
|
||||||
settings = [
|
|
||||||
{
|
|
||||||
layer = "top";
|
|
||||||
modules-left = [
|
|
||||||
"pulseaudio"
|
|
||||||
];
|
|
||||||
modules-right = [
|
|
||||||
"battery"
|
|
||||||
"clock"
|
|
||||||
];
|
|
||||||
"pulseaudio" = {
|
|
||||||
format = "{icon} {volume}%";
|
|
||||||
format-muted = "";
|
|
||||||
format-icons.default = [
|
|
||||||
""
|
|
||||||
""
|
|
||||||
];
|
|
||||||
on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
|
||||||
};
|
|
||||||
"clock" = {
|
|
||||||
interval = 1;
|
|
||||||
format = "{:%F %T}";
|
|
||||||
};
|
|
||||||
"battery" = {
|
|
||||||
interval = 1;
|
|
||||||
bat-compatibility = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
style = # css
|
|
||||||
''
|
|
||||||
window#waybar {
|
|
||||||
background-color: rgba(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pulseaudio,
|
|
||||||
#battery,
|
|
||||||
#clock {
|
|
||||||
padding-top: 5px;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
padding-right: 5px;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
services = {
|
|
||||||
spotifyd.enable = true;
|
|
||||||
spotifyd.settings.global = {
|
|
||||||
device_name = "${hostName}";
|
|
||||||
device_type = "computer";
|
|
||||||
zeroconf_port = 5353;
|
|
||||||
};
|
|
||||||
|
|
||||||
mako.enable = true;
|
|
||||||
mako.settings.default-timeout = 10000;
|
|
||||||
|
|
||||||
};
|
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
# This is needed for UWSM
|
|
||||||
systemd.enable = false;
|
|
||||||
# Null the packages since we use them system wide
|
|
||||||
package = null;
|
|
||||||
portalPackage = null;
|
|
||||||
settings = mkMerge [
|
|
||||||
(import ./_hyprland/decoration.nix)
|
|
||||||
(import ./_hyprland/keybinds.nix { inherit pkgs; })
|
|
||||||
{
|
|
||||||
ecosystem.no_update_news = true;
|
|
||||||
xwayland.force_zero_scaling = true;
|
|
||||||
monitor =
|
|
||||||
let
|
|
||||||
mainMonitor = hostConfig.machine.monitors.main;
|
|
||||||
in
|
|
||||||
[
|
|
||||||
"${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
|
|
||||||
", preferred, auto, 1"
|
|
||||||
];
|
|
||||||
exec-once = [
|
|
||||||
"uwsm app -- $LOCKSCREEN"
|
|
||||||
"uwsm app -- $NOTIFICATION_DAEMON"
|
|
||||||
"uwsm app -- $STATUS_BAR"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
# xdg.configFile."uwsm/env".text = # sh
|
|
||||||
# ''
|
|
||||||
# # Force apps to scale right with Wayland
|
|
||||||
# export GDK_SCALE=${mainMonitor.scale}
|
|
||||||
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
|
|
||||||
# '';
|
|
||||||
# xdg.configFile."uwsm/env-hyprland".text = # sh
|
|
||||||
# ''
|
|
||||||
# export GDK_SCALE=${mainMonitor.scale}
|
|
||||||
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
|
|
||||||
# '';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
232
nix/homes/rafiq/desktop/nixos.nix
Normal file
232
nix/homes/rafiq/desktop/nixos.nix
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
inherit (config.manifest) admin;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
allowedUnfreePackages = [
|
||||||
|
"stremio-shell"
|
||||||
|
"stremio-server"
|
||||||
|
"steam"
|
||||||
|
"steam-unwrapped"
|
||||||
|
];
|
||||||
|
flake.modules.nixos.graphical =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
fonts.packages = [ pkgs.font-awesome ];
|
||||||
|
services.getty.autologinUser = admin.username;
|
||||||
|
# Start Hyprland at boot only if not connecting through SSH
|
||||||
|
environment.loginShellInit = # sh
|
||||||
|
''
|
||||||
|
if [[ -z "$SSH_CLIENT" && -z "$SSH_CONNECTION" ]]; then
|
||||||
|
if uwsm check may-start; then
|
||||||
|
exec uwsm start hyprland-uwsm.desktop
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
environment.variables = {
|
||||||
|
# Get Electron apps to use Wayland
|
||||||
|
ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||||
|
NIXOS_OZONE_WL = "1";
|
||||||
|
};
|
||||||
|
programs = {
|
||||||
|
hyprland = {
|
||||||
|
enable = true;
|
||||||
|
# Use UWSM to have each process controlled by systemd init
|
||||||
|
withUWSM = true;
|
||||||
|
};
|
||||||
|
steam = {
|
||||||
|
enable = true;
|
||||||
|
gamescopeSession.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
security.pam.services.hyprlock = { };
|
||||||
|
services.sunshine = {
|
||||||
|
enable = true;
|
||||||
|
capSysAdmin = true;
|
||||||
|
openFirewall = true;
|
||||||
|
settings = {
|
||||||
|
sunshine_name = config.networking.hostName;
|
||||||
|
origin_pin_allowed = "wan";
|
||||||
|
origin_web_ui_allowed = "wan";
|
||||||
|
};
|
||||||
|
applications = { };
|
||||||
|
};
|
||||||
|
# spotifyd
|
||||||
|
networking.firewall.allowedTCPPorts = [ 5353 ];
|
||||||
|
networking.firewall.allowedUDPPorts = [ 5353 ];
|
||||||
|
};
|
||||||
|
flake.modules.homeManager.rafiq =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
hostName,
|
||||||
|
hostConfig,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
|
in
|
||||||
|
mkIf (config.graphical && pkgs.system == "x86_64-linux") {
|
||||||
|
stylix.targets.waybar.addCss = false;
|
||||||
|
persistDirs = [
|
||||||
|
"docs"
|
||||||
|
"repos"
|
||||||
|
"vids"
|
||||||
|
"tmp"
|
||||||
|
".cache/Smart Code ltd/Stremio"
|
||||||
|
".local/share/Smart Code ltd/Stremio"
|
||||||
|
".mozilla/firefox"
|
||||||
|
".tor project"
|
||||||
|
".local/share/Steam"
|
||||||
|
".local/share/PrismLauncher"
|
||||||
|
".config/sunshine"
|
||||||
|
];
|
||||||
|
home = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
wl-clipboard-rs
|
||||||
|
stremio
|
||||||
|
tor-browser
|
||||||
|
vlc
|
||||||
|
prismlauncher
|
||||||
|
];
|
||||||
|
sessionVariables = {
|
||||||
|
LAUNCHER = "fuzzel";
|
||||||
|
LOCKSCREEN = "hyprlock";
|
||||||
|
NOTIFICATION_DAEMON = "mako";
|
||||||
|
STATUS_BAR = "waybar";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# xdg.configFile."uwsm/env".text = # sh
|
||||||
|
# ''
|
||||||
|
# # Force apps to scale right with Wayland
|
||||||
|
# export GDK_SCALE=${mainMonitor.scale}
|
||||||
|
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
|
||||||
|
# '';
|
||||||
|
# xdg.configFile."uwsm/env-hyprland".text = # sh
|
||||||
|
# ''
|
||||||
|
# export GDK_SCALE=${mainMonitor.scale}
|
||||||
|
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
|
||||||
|
# '';
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
# This is needed for UWSM
|
||||||
|
systemd.enable = false;
|
||||||
|
# Null the packages since we use them system wide
|
||||||
|
package = null;
|
||||||
|
portalPackage = null;
|
||||||
|
settings = mkMerge [
|
||||||
|
(import ./_hyprland/decoration.nix)
|
||||||
|
(import ./_hyprland/keybinds.nix { inherit pkgs; })
|
||||||
|
{
|
||||||
|
ecosystem.no_update_news = true;
|
||||||
|
xwayland.force_zero_scaling = true;
|
||||||
|
monitor =
|
||||||
|
let
|
||||||
|
mainMonitor = hostConfig.machine.monitors.main;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
|
||||||
|
", preferred, auto, 1"
|
||||||
|
];
|
||||||
|
exec-once = [
|
||||||
|
"uwsm app -- $LOCKSCREEN"
|
||||||
|
"uwsm app -- $NOTIFICATION_DAEMON"
|
||||||
|
"uwsm app -- $STATUS_BAR"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services = {
|
||||||
|
spotifyd.enable = true;
|
||||||
|
spotifyd.settings.global = {
|
||||||
|
device_name = "${hostName}";
|
||||||
|
device_type = "computer";
|
||||||
|
zeroconf_port = 5353;
|
||||||
|
};
|
||||||
|
mako.enable = true;
|
||||||
|
mako.settings.default-timeout = 10000;
|
||||||
|
};
|
||||||
|
programs = {
|
||||||
|
obs-studio.enable = true;
|
||||||
|
fuzzel.enable = true;
|
||||||
|
ghostty.enable = true;
|
||||||
|
waybar = {
|
||||||
|
enable = true;
|
||||||
|
settings = [
|
||||||
|
{
|
||||||
|
layer = "top";
|
||||||
|
modules-left = [
|
||||||
|
"pulseaudio"
|
||||||
|
];
|
||||||
|
modules-right = [
|
||||||
|
"battery"
|
||||||
|
"clock"
|
||||||
|
];
|
||||||
|
"pulseaudio" = {
|
||||||
|
format = "{icon} {volume}%";
|
||||||
|
format-muted = "";
|
||||||
|
format-icons.default = [
|
||||||
|
""
|
||||||
|
""
|
||||||
|
];
|
||||||
|
on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
||||||
|
};
|
||||||
|
"clock" = {
|
||||||
|
interval = 1;
|
||||||
|
format = "{:%F %T}";
|
||||||
|
};
|
||||||
|
"battery" = {
|
||||||
|
interval = 1;
|
||||||
|
bat-compatibility = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
style = # css
|
||||||
|
''
|
||||||
|
window#waybar {
|
||||||
|
background-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pulseaudio,
|
||||||
|
#battery,
|
||||||
|
#clock {
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
hyprlock = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
general.hide_cursor = true;
|
||||||
|
general.ignore_empty_input = true;
|
||||||
|
background.blur_passes = 5;
|
||||||
|
background.blur_size = 5;
|
||||||
|
label = {
|
||||||
|
text = ''hi, $USER.'';
|
||||||
|
font_size = 32;
|
||||||
|
position = "0, 0";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
zindex = 1;
|
||||||
|
shadow_passes = 5;
|
||||||
|
shadow_size = 5;
|
||||||
|
};
|
||||||
|
input-field = {
|
||||||
|
placeholder_text = "";
|
||||||
|
fade_on_empty = true;
|
||||||
|
size = "200, 45";
|
||||||
|
position = "0, -5%";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
zindex = 1;
|
||||||
|
shadow_passes = 5;
|
||||||
|
shadow_size = 5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
|
||||||
inherit (builtins) foldl' attrNames;
|
inherit (builtins) foldl' attrNames;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
in
|
in
|
||||||
|
@ -35,7 +34,7 @@ in
|
||||||
|
|
||||||
:::
|
:::
|
||||||
*/
|
*/
|
||||||
userListToAttrs = f: foldl' (acc: elem: acc // (f elem)) { } (attrNames cfg.manifest.users);
|
userListToAttrs = f: foldl' (acc: elem: acc // (f elem)) { } (attrNames config.manifest.users);
|
||||||
/**
|
/**
|
||||||
Return an attribute set for use with a option that needs to be used for all users.
|
Return an attribute set for use with a option that needs to be used for all users.
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ in
|
||||||
|
|
||||||
:::
|
:::
|
||||||
*/
|
*/
|
||||||
forAllUsers = attrset: mapAttrs (_: _: attrset) cfg.manifest.users;
|
forAllUsers = attrset: mapAttrs (_: _: attrset) config.manifest.users;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Like forAllUsers, but passes in the name and value from the manifest.
|
Like forAllUsers, but passes in the name and value from the manifest.
|
||||||
|
@ -96,6 +95,6 @@ in
|
||||||
|
|
||||||
:::
|
:::
|
||||||
*/
|
*/
|
||||||
forAllUsers' = f: mapAttrs f cfg.manifest.users;
|
forAllUsers' = f: mapAttrs f config.manifest.users;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
flake.manifest = {
|
manifest = {
|
||||||
users.rafiq = {
|
users.rafiq = {
|
||||||
primary = true;
|
primary = true;
|
||||||
name = "Mohammad Rafiq";
|
name = "Mohammad Rafiq";
|
||||||
|
@ -7,7 +7,18 @@
|
||||||
shell = "fish";
|
shell = "fish";
|
||||||
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq";
|
pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq";
|
||||||
};
|
};
|
||||||
hosts.nixos = {
|
hosts = {
|
||||||
|
darwin = {
|
||||||
|
venus = {
|
||||||
|
graphical = true;
|
||||||
|
machine.platform = "intel";
|
||||||
|
};
|
||||||
|
hephaestus = {
|
||||||
|
graphical = true;
|
||||||
|
machine.platform = "apple-silicon";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
nixos = {
|
||||||
nemesis = {
|
nemesis = {
|
||||||
graphical = true;
|
graphical = true;
|
||||||
machine = {
|
machine = {
|
||||||
|
@ -22,10 +33,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
extraCfg = {
|
extraCfg = {
|
||||||
services.fwupd.enable = true; # FIXME: remove
|
|
||||||
machine = {
|
machine = {
|
||||||
bluetooth.enable = true;
|
bluetooth.enable = true;
|
||||||
usb.automount = true;
|
usb.automount = true;
|
||||||
|
usb.qmk.enable = true;
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
podman.enable = true;
|
podman.enable = true;
|
||||||
podman.distrobox.enable = true;
|
podman.distrobox.enable = true;
|
||||||
|
@ -89,4 +100,5 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
78
nix/meta.nix
78
nix/meta.nix
|
@ -5,57 +5,14 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (cfg.lib.options) mkStrOption;
|
inherit (lib.types) path lazyAttrsOf raw;
|
||||||
inherit (lib.types)
|
|
||||||
path
|
|
||||||
lazyAttrsOf
|
|
||||||
raw
|
|
||||||
deferredModule
|
|
||||||
submodule
|
|
||||||
;
|
|
||||||
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
|
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
|
||||||
inherit (cfg.lib.attrsets) firstAttrNameMatching;
|
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
monitorOpts = submodule {
|
|
||||||
options = {
|
|
||||||
id = mkStrOption "";
|
|
||||||
resolution = mkStrOption "";
|
|
||||||
refresh-rate = mkStrOption "";
|
|
||||||
scale = mkStrOption "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
userOpts = submodule {
|
|
||||||
options = {
|
|
||||||
username = mkStrOption "";
|
|
||||||
primary = mkEnableOption "";
|
|
||||||
name = mkStrOption "";
|
|
||||||
email = mkStrOption "";
|
|
||||||
shell = mkStrOption "";
|
|
||||||
pubkey = mkStrOption "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
hostOpts = submodule {
|
|
||||||
options = {
|
|
||||||
graphical = mkEnableOption "";
|
|
||||||
machine = {
|
|
||||||
platform = mkStrOption "";
|
|
||||||
gpu = mkStrOption "";
|
|
||||||
root.drive = mkStrOption "";
|
|
||||||
monitors = mkOption {
|
|
||||||
type = lazyAttrsOf monitorOpts;
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
extraCfg = mkOption {
|
|
||||||
type = deferredModule;
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.flake = mkSubmoduleOptions {
|
options.flake = mkSubmoduleOptions {
|
||||||
|
self = mkOption { type = raw; };
|
||||||
lib = mkOption {
|
lib = mkOption {
|
||||||
type = lazyAttrsOf raw;
|
type = lazyAttrsOf raw;
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -67,35 +24,8 @@ in
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
manifest = mkOption {
|
|
||||||
type = submodule {
|
|
||||||
options = {
|
|
||||||
users = mkOption {
|
|
||||||
type = lazyAttrsOf userOpts;
|
|
||||||
default = { };
|
|
||||||
};
|
};
|
||||||
hosts = mkOption {
|
config.flake = {
|
||||||
# hosts.nixos, hosts.darwin, etc.
|
|
||||||
type = lazyAttrsOf (lazyAttrsOf hostOpts);
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# Helper Option
|
|
||||||
admin = mkOption {
|
|
||||||
type = userOpts;
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config.flake =
|
|
||||||
let
|
|
||||||
username = firstAttrNameMatching (_: v: v.primary or false) cfg.manifest.users;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
paths.secrets = cfg.paths.root + "/secrets";
|
paths.secrets = cfg.paths.root + "/secrets";
|
||||||
admin = cfg.manifest.users.${username} // {
|
|
||||||
inherit username;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.flake) manifest;
|
inherit (config.manifest) users;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.homeManager.default =
|
flake.modules.homeManager.default =
|
||||||
|
@ -9,8 +9,8 @@ in
|
||||||
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = manifest.users.${config.home.username}.name;
|
userName = users.${config.home.username}.name;
|
||||||
userEmail = manifest.users.${config.home.username}.email;
|
userEmail = users.${config.home.username}.email;
|
||||||
signing.key = "~/.ssh/id_ed25519.pub";
|
signing.key = "~/.ssh/id_ed25519.pub";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,4 +3,11 @@
|
||||||
"nix-command"
|
"nix-command"
|
||||||
"flakes"
|
"flakes"
|
||||||
];
|
];
|
||||||
|
flake.modules.darwin.default = {
|
||||||
|
nix.enable = false;
|
||||||
|
nix.settings.experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,36 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
|
inherit (config.manifest) users;
|
||||||
inherit (cfg.lib.modules) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
inherit (lib.attrsets) mapAttrs';
|
inherit (lib.attrsets) mapAttrs';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules = {
|
||||||
|
nixos.default =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs = mapAttrs' (name: value: {
|
programs = mapAttrs' (name: value: {
|
||||||
name = value.shell;
|
name = value.shell;
|
||||||
value.enable = true;
|
value.enable = true;
|
||||||
}) cfg.manifest.users;
|
}) users;
|
||||||
users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; });
|
users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; });
|
||||||
};
|
};
|
||||||
flake.modules.homeManager.default =
|
darwin.default =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
programs = mapAttrs' (name: value: {
|
||||||
|
name = value.shell;
|
||||||
|
value.enable = true;
|
||||||
|
}) users;
|
||||||
|
users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; });
|
||||||
|
environment.shells = [ pkgs.fish ];
|
||||||
|
};
|
||||||
|
homeManager.default =
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
programs.${cfg.manifest.users.${config.home.username}.shell}.enable = true;
|
programs.${users.${config.home.username}.shell}.enable = true;
|
||||||
home.shell.enableShellIntegration = true;
|
home.shell.enableShellIntegration = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,15 @@ let
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.graphical = {
|
flake.modules = {
|
||||||
|
nixos.graphical = {
|
||||||
home-manager.sharedModules = [ { graphical = true; } ];
|
home-manager.sharedModules = [ { graphical = true; } ];
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
flake.modules.homeManager.default.options.graphical = mkEnableOption "";
|
homeManager.default.options.graphical = mkEnableOption "";
|
||||||
|
darwin.graphical.home-manager.sharedModules = [ { graphical = true; } ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,12 @@
|
||||||
stylix.enable = true;
|
stylix.enable = true;
|
||||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
|
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
|
||||||
};
|
};
|
||||||
|
flake.modules.darwin.default =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [ inputs.stylix.darwinModules.stylix ];
|
||||||
|
stylix.enable = true;
|
||||||
|
#TODO: move into manifest
|
||||||
|
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules.nixos.default =
|
||||||
{ config, modulesPath, ... }:
|
{
|
||||||
|
config,
|
||||||
|
modulesPath,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.machine;
|
cfg = config.machine;
|
||||||
in
|
in
|
||||||
|
@ -14,6 +19,7 @@ in
|
||||||
options.machine = {
|
options.machine = {
|
||||||
bluetooth.enable = mkEnableOption "";
|
bluetooth.enable = mkEnableOption "";
|
||||||
usb.automount = mkEnableOption "";
|
usb.automount = mkEnableOption "";
|
||||||
|
usb.qmk.enable = mkEnableOption "";
|
||||||
};
|
};
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf cfg.usb.automount {
|
(mkIf cfg.usb.automount {
|
||||||
|
@ -28,6 +34,18 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
(mkIf cfg.usb.qmk.enable {
|
||||||
|
hardware.keyboard.qmk.enable = true;
|
||||||
|
services.udev = {
|
||||||
|
packages = with pkgs; [
|
||||||
|
vial
|
||||||
|
qmk
|
||||||
|
qmk-udev-rules
|
||||||
|
qmk_hid
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
})
|
||||||
(mkIf cfg.bluetooth.enable {
|
(mkIf cfg.bluetooth.enable {
|
||||||
persistDirs = [ "/var/lib/bluetooth" ];
|
persistDirs = [ "/var/lib/bluetooth" ];
|
||||||
hardware.bluetooth = {
|
hardware.bluetooth = {
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
{ config, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.flake;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
allowedUnfreePackages = [
|
allowedUnfreePackages = [
|
||||||
"nvidia-x11"
|
"nvidia-x11"
|
||||||
|
@ -11,11 +7,11 @@ in
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
hostName,
|
hostConfig,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
gpu = cfg.manifest.hosts.nixos.${hostName}.machine.gpu or "";
|
inherit (hostConfig.machine) gpu;
|
||||||
in
|
in
|
||||||
if gpu == "nvidia" then
|
if gpu == "nvidia" then
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{ config, ... }:
|
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules.nixos.default =
|
||||||
{ hostName, ... }:
|
{ hostConfig, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.flake.manifest.hosts.nixos.${hostName}.machine) platform;
|
inherit (hostConfig.machine) platform;
|
||||||
arch = if platform == "amd" || platform == "intel" then "x86_64" else "aarch64";
|
arch = if platform == "amd" || platform == "intel" then "x86_64" else "aarch64";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -11,4 +10,14 @@
|
||||||
boot.kernelModules = [ "kvm-${platform}" ];
|
boot.kernelModules = [ "kvm-${platform}" ];
|
||||||
nixpkgs.hostPlatform = "${arch}-linux";
|
nixpkgs.hostPlatform = "${arch}-linux";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flake.modules.darwin.default =
|
||||||
|
{ hostConfig, ... }:
|
||||||
|
let
|
||||||
|
inherit (hostConfig.machine) platform;
|
||||||
|
arch = if platform == "intel" then "x86_64" else "aarch64";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nixpkgs.hostPlatform = "${arch}-darwin";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
{
|
{ lib, inputs, ... }:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
let
|
||||||
inherit (lib.modules) mkMerge mkIf mkAfter;
|
inherit (lib.modules) mkMerge mkIf mkAfter;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules.nixos.default =
|
||||||
{ hostName, ... }:
|
{ hostConfig, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.flake.manifest.hosts.nixos.${hostName}.machine) root;
|
inherit (hostConfig.machine) root;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.disko.nixosModules.disko ];
|
imports = [ inputs.disko.nixosModules.disko ];
|
||||||
|
@ -85,7 +80,7 @@ in
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# Ephemeral by default - assumes btrfs
|
# Ephemeral by default - assumes btrfs
|
||||||
(mkIf (config.flake.manifest.hosts.nixos.${hostName}.machine.root.ephemeral or true) {
|
(mkIf root.ephemeral {
|
||||||
boot.initrd.postDeviceCommands = mkAfter ''
|
boot.initrd.postDeviceCommands = mkAfter ''
|
||||||
mkdir /btrfs_tmp
|
mkdir /btrfs_tmp
|
||||||
mount /dev/root_vg/root /btrfs_tmp
|
mount /dev/root_vg/root /btrfs_tmp
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
|
inherit (config.manifest) admin;
|
||||||
inherit (lib.modules) mkMerge;
|
inherit (lib.modules) mkMerge;
|
||||||
inherit (cfg.lib.modules) forAllUsers';
|
inherit (cfg.lib.modules) forAllUsers';
|
||||||
in
|
in
|
||||||
|
@ -16,7 +17,7 @@ in
|
||||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ users.users.root.openssh.authorizedKeys.keys = [ cfg.admin.pubkey ]; }
|
{ users.users.root.openssh.authorizedKeys.keys = [ admin.pubkey ]; }
|
||||||
];
|
];
|
||||||
flake.modules.homeManager.default = {
|
flake.modules.homeManager.default = {
|
||||||
persistDirs = [ ".ssh" ];
|
persistDirs = [ ".ssh" ];
|
||||||
|
|
|
@ -14,4 +14,12 @@ in
|
||||||
persistDirs = [ "/var/lib/tailscale" ];
|
persistDirs = [ "/var/lib/tailscale" ];
|
||||||
sops.secrets."tailscale/client-secret".sopsFile = secrets + "/tailscale.yaml";
|
sops.secrets."tailscale/client-secret".sopsFile = secrets + "/tailscale.yaml";
|
||||||
};
|
};
|
||||||
|
flake.modules.darwin.default =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.tailscale = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.tailscale.overrideAttrs { doCheck = false; };
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ let
|
||||||
inherit (config.flake.lib.options) mkStrOption mkPathOption;
|
inherit (config.flake.lib.options) mkStrOption mkPathOption;
|
||||||
inherit (config.flake.lib.services) mkRootDomain;
|
inherit (config.flake.lib.services) mkRootDomain;
|
||||||
inherit (config.flake.paths) secrets;
|
inherit (config.flake.paths) secrets;
|
||||||
inherit (config.flake.admin) email;
|
inherit (config.manifest.admin) email;
|
||||||
inherit (lib.types) listOf submodule attrs;
|
inherit (lib.types) listOf submodule attrs;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.modules) mkMerge mkIf;
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
|
|
11
nix/modules/system/homebrew.nix
Normal file
11
nix/modules/system/homebrew.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
inherit (config.manifest) admin;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.darwin.graphical.homebrew = {
|
||||||
|
enable = true;
|
||||||
|
user = admin.username;
|
||||||
|
onActivation.cleanup = "uninstall";
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (config.flake.lib.options) mkStrOption;
|
inherit (config.flake.lib.options) mkStrOption;
|
||||||
inherit (lib.types)
|
inherit (lib.types)
|
||||||
|
@ -49,15 +50,17 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
flake.modules.homeManager.default =
|
flake.modules.homeManager.default =
|
||||||
{ config, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [ inputs.impermanence.homeManagerModules.impermanence ];
|
imports = [ inputs.impermanence.homeManagerModules.impermanence ];
|
||||||
options.persistDirs = mkOpts "directory" { };
|
options.persistDirs = mkOpts "directory" { };
|
||||||
options.persistFiles = mkOpts "file" { };
|
options.persistFiles = mkOpts "file" { };
|
||||||
config.home.persistence."/persist${config.home.homeDirectory}" = {
|
config = mkIf (pkgs.system == "x86_64-linux") {
|
||||||
|
home.persistence."/persist${config.home.homeDirectory}" = {
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
directories = config.persistDirs;
|
directories = config.persistDirs;
|
||||||
files = config.persistFiles;
|
files = config.persistFiles;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,48 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
|
inherit (cfg.paths) secrets;
|
||||||
inherit (builtins) readFile;
|
inherit (builtins) readFile;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.strings) trim;
|
inherit (lib.strings) trim;
|
||||||
inherit (cfg.admin) username pubkey;
|
inherit (config.manifest.admin) username pubkey;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules = {
|
||||||
|
nixos.default =
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
config.sops.age.sshKeyPaths = [
|
config = {
|
||||||
|
sops = {
|
||||||
|
age.sshKeyPaths = [
|
||||||
"/persist${config.users.defaultUserHome}/${username}/.ssh/id_ed25519"
|
"/persist${config.users.defaultUserHome}/${username}/.ssh/id_ed25519"
|
||||||
];
|
];
|
||||||
|
secrets."keys/gemini".sopsFile = secrets + "/keys.yaml";
|
||||||
|
};
|
||||||
|
environment.shellInit = # sh
|
||||||
|
''
|
||||||
|
export GEMINI_API_KEY=$(sudo cat ${config.sops.secrets."keys/gemini".path})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
darwin.default =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
imports = [ inputs.sops-nix.darwinModules.sops ];
|
||||||
|
config = {
|
||||||
|
sops = {
|
||||||
|
age.sshKeyPaths = [ "${config.users.users.${username}.home}/.ssh/id_ed25519" ];
|
||||||
|
secrets."keys/gemini".sopsFile = secrets + "/keys.yaml";
|
||||||
|
};
|
||||||
|
environment.shellInit = # sh
|
||||||
|
''
|
||||||
|
export GEMINI_API_KEY=$(sudo cat ${config.sops.secrets."keys/gemini".path})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
homeManager.default.persistDirs = [ ".config/sops/age" ];
|
||||||
};
|
};
|
||||||
flake.modules.homeManager.default.persistDirs = [ ".config/sops/age" ];
|
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
inherit (config.manifest) admin;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default = {
|
flake.modules.nixos.default = {
|
||||||
security.sudo.wheelNeedsPassword = false;
|
security.sudo.wheelNeedsPassword = false;
|
||||||
nix.settings.trusted-users = [ "@wheel" ];
|
nix.settings.trusted-users = [ "@wheel" ];
|
||||||
users.users.${cfg.admin.username}.extraGroups = [ "wheel" ];
|
users.users.${admin.username}.extraGroups = [ "wheel" ];
|
||||||
|
};
|
||||||
|
flake.modules.darwin.default.security = {
|
||||||
|
sudo.extraConfig = "%admin ALL = (ALL) NOPASSWD: ALL";
|
||||||
|
pam.services.sudo_local = {
|
||||||
|
enable = true;
|
||||||
|
reattach = true;
|
||||||
|
touchIdAuth = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default = {
|
flake.modules = {
|
||||||
|
nixos.default = {
|
||||||
persistFiles = [ "/etc/machine-id" ];
|
persistFiles = [ "/etc/machine-id" ];
|
||||||
persistDirs = [ "/var/lib/systemd" ];
|
persistDirs = [ "/var/lib/systemd" ];
|
||||||
time.timeZone = "Asia/Singapore";
|
time.timeZone = "Asia/Singapore";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
system.stateVersion = "25.11";
|
system.stateVersion = "25.11";
|
||||||
};
|
};
|
||||||
flake.modules.homeManager.default =
|
homeManager.default.home.stateVersion = "25.11";
|
||||||
{ osConfig, ... }:
|
darwin.default =
|
||||||
|
{ self, ... }:
|
||||||
{
|
{
|
||||||
home.stateVersion = osConfig.system.stateVersion;
|
system.configurationRevision = self.rev or self.dirtyRev or null;
|
||||||
|
system.stateVersion = 6;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
|
inherit (config.manifest) users admin;
|
||||||
inherit (cfg.lib.modules) userListToAttrs forAllUsers';
|
inherit (cfg.lib.modules) userListToAttrs forAllUsers';
|
||||||
|
inherit (lib.lists) findFirstIndex;
|
||||||
|
inherit (builtins) attrNames;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules.nixos.default =
|
||||||
|
@ -31,4 +34,22 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
flake.modules.darwin.default =
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
system.primaryUser = admin.username;
|
||||||
|
users.knownUsers = attrNames users;
|
||||||
|
users.users = forAllUsers' (
|
||||||
|
name: _: {
|
||||||
|
home = "/Users/${name}";
|
||||||
|
uid = 501 + (findFirstIndex (x: x == name) null (attrNames users));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
home-manager.users = forAllUsers' (
|
||||||
|
name: _: {
|
||||||
|
home.username = name;
|
||||||
|
home.homeDirectory = config.users.users.${name}.home;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ in
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
config.flake.modules.nixos.default = {
|
config.flake.modules = {
|
||||||
nixpkgs.config.allowUnfreePredicate = predicate;
|
nixos.default.nixpkgs.config.allowUnfreePredicate = predicate;
|
||||||
|
darwin.default.nixpkgs.config.allowUnfreePredicate = predicate;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue