Compare commits

..

No commits in common. "6cf8344ed90c64c746e729f79656064b57f69675" and "dc63b9cdb3d9fd9b87cfcc0ce3c4ce015ecc9bfd" have entirely different histories.

39 changed files with 637 additions and 745 deletions

1
.gitignore vendored
View File

@ -4,4 +4,3 @@ result-*
.nvimlog .nvimlog
.pre-commit-config.yaml .pre-commit-config.yaml
.direnv/ .direnv/
.DS_Store

7
darwin/copy-apps.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs, lib, ... }:
let mac-app-util = lib.getExe' pkgs.mac-app-util "mac-app-util";
in {
system.activationScripts.postActivation.text = ''
${mac-app-util} sync-trampolines "/Applications/Nix Apps" "/Applications/Nix Trampolines"
'';
}

View File

@ -1,24 +1,19 @@
{ self, config, ... }: { self, config, ... }: {
{
flake.darwinModules = { flake.darwinModules = {
home = home = let inherit (config.users) me;
let in {
inherit (config.me) username; home-manager.users.${me} = { imports = [ self.homeModules.darwin ]; };
in users.users.${me} = {
{ name = me;
home-manager.users.${username} = { home = "/Users/${me}";
imports = [ self.homeModules.darwin ];
};
users.users.${username} = {
name = username;
home = "/Users/${username}";
};
}; };
};
default.imports = [ default.imports = [
self.darwinModules_.home-manager self.darwinModules_.home-manager
self.darwinModules.home self.darwinModules.home
self.nixosModules.common self.nixosModules.common
./copy-apps.nix
./fish.nix ./fish.nix
./fonts.nix ./fonts.nix
./homebrew.nix ./homebrew.nix

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
environment.variables.SHELL = lib.getExe pkgs.fish; environment.variables.SHELL = lib.getExe pkgs.fish;
environment.shells = [ pkgs.fish ]; environment.shells = [ pkgs.fish ];
programs.fish = { programs.fish = {

View File

@ -1,19 +1,15 @@
{ pkgs, ... }: { pkgs, ... }: {
{ fonts.fontDir.enable = true;
fonts.packages = builtins.attrValues { fonts.fonts = builtins.attrValues {
inherit (pkgs) inherit (pkgs)
borg-sans-mono borg-sans-mono recursive-patched
recursive-patched
# code^ # code^
ia-writer-family ia-writer-family ibm-plex
ibm-plex
# hybrid^ # hybrid^
inter inter source-sans-pro source-serif-pro
source-sans-pro
source-serif-pro
# display^ # display^
; ;
}; };
} }

View File

@ -1,5 +1,4 @@
{ flake, config, ... }: { flake, config, ... }: {
{
environment.variables.HOMEBREW_NO_ANALYTICS = "1"; environment.variables.HOMEBREW_NO_ANALYTICS = "1";
programs.fish = { programs.fish = {
shellInit = '' shellInit = ''
@ -37,7 +36,6 @@
Amphetamine = 937984704; Amphetamine = 937984704;
"Draw Things" = 6444050820; "Draw Things" = 6444050820;
GrandPerspective = 1111570163; GrandPerspective = 1111570163;
Omnivore = 1564031042;
Tailscale = 1475387142; Tailscale = 1475387142;
Things = 904280696; Things = 904280696;
Xcode = 497799835; Xcode = 497799835;
@ -51,11 +49,9 @@
"knockknock" "knockknock"
"lulu" "lulu"
"protonvpn" "protonvpn"
"rectangle"
"secretive" "secretive"
"shortcat" "shortcat"
"stay" "stay"
"utm"
# design # design
"imageoptim" "imageoptim"
@ -68,11 +64,8 @@
"orion" "orion"
# messaging apps # messaging apps
"discord"
"messenger" "messenger"
"signal" "signal"
"slack"
"zoom"
# editors and IDEs # editors and IDEs
"lapce" "lapce"

View File

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"cl-nix-lite": { "cl-nix-lite": {
"locked": { "locked": {
"lastModified": 1717972076, "lastModified": 1698901928,
"narHash": "sha256-hnZEsDInTcsVSL5LBGDAZegAxVLBus/wiJh+sNM15zU=", "narHash": "sha256-gMHZybEVA3uMOBu1483gXfvUqpv4Qn7GJs3ZfCQYxpc=",
"owner": "hraban", "owner": "hraban",
"repo": "cl-nix-lite", "repo": "cl-nix-lite",
"rev": "cc920bfb0a6402d3871f470c98d65266126973e4", "rev": "9ad861b45bda7f59eba5ad1b43565a03c7c58553",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -23,11 +23,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1709610799, "lastModified": 1701025348,
"narHash": "sha256-5jfLQx0U9hXbi2skYMGodDJkIgffrjIOgMRjZqms2QE=", "narHash": "sha256-42GHmYH+GF7VjwGSt+fVT1CQuNpGanJbNgVHTAZppUM=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "81c393c776d5379c030607866afef6406ca1be57", "rev": "42afaeb1a0325194a7cdb526332d2cb92fddd07b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -43,11 +43,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1721266288, "lastModified": 1704741201,
"narHash": "sha256-MsyTzXu9CJVcBr44ct8ILKF/Ro7VlF+tVZTylzAoXSs=", "narHash": "sha256-Y420NeqPWRSpxHpXsxhKILfTxT5exjtTgCgDwSpcEfU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "e8e8d9a3a9c1d0e654ccda7834bf0288a9d15c47", "rev": "f0a3425a7b173701922e7959d8bfb136ef53aa54",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -91,11 +91,11 @@
"fish-plugin-done": { "fish-plugin-done": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1712867771, "lastModified": 1704894068,
"narHash": "sha256-DMIRKRAVOn7YEnuAtz4hIxrU93ULxNoQhW6juxCoh4o=", "narHash": "sha256-VSCYsGjNPSFIZSdLrkc7TU7qyPVm8UupOoav5UqXPMk=",
"owner": "franciscolourenco", "owner": "franciscolourenco",
"repo": "done", "repo": "done",
"rev": "eb32ade85c0f2c68cbfcff3036756bbf27a4f366", "rev": "d47f4d6551cccb0e46edfb14213ca0097ee22f9a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -139,11 +139,11 @@
"fish-plugin-replay": { "fish-plugin-replay": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1719805987, "lastModified": 1655689996,
"narHash": "sha256-TzQ97h9tBRUg+A7DSKeTBWLQuThicbu19DHMwkmUXdg=", "narHash": "sha256-bM6+oAd/HXaVgpJMut8bwqO54Le33hwO9qet9paK1kY=",
"owner": "jorgebucaran", "owner": "jorgebucaran",
"repo": "replay.fish", "repo": "replay.fish",
"rev": "d2ecacd3fe7126e822ce8918389f3ad93b14c86c", "rev": "bd8e5b89ec78313538e747f0292fcaf631e87bd2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -172,11 +172,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1673956053,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -190,11 +190,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1719994518, "lastModified": 1704152458,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "rev": "88a2cd8166694ba0b6cb374700799cec53aef527",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -208,11 +208,11 @@
"nixpkgs-lib": "nixpkgs-lib_2" "nixpkgs-lib": "nixpkgs-lib_2"
}, },
"locked": { "locked": {
"lastModified": 1714606777, "lastModified": 1701473968,
"narHash": "sha256-bMkNmAXLj8iyTvxaaD/StcLSadbj1chPcJOjtuVnLmA=", "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "4d34ce6412bc450b1d4208c953dc97c7fc764f1a", "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -221,31 +221,16 @@
"type": "github" "type": "github"
} }
}, },
"flake-root": {
"locked": {
"lastModified": 1713493429,
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
"owner": "srid",
"repo": "flake-root",
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1709126324, "lastModified": 1694529238,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605", "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -259,11 +244,11 @@
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1694529238,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -276,11 +261,29 @@
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1701680307,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -312,11 +315,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1709087332, "lastModified": 1660459072,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -335,11 +338,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1721311810, "lastModified": 1704763276,
"narHash": "sha256-TH8mqGhsAywPJv5YUNgl8Zcd896+I3JRCX3IGGd1PLk=", "narHash": "sha256-dwRpOmBql51/BDcyDPSOAYZyHXYrW/Hry0smjOHZuCI=",
"owner": "helix-editor", "owner": "helix-editor",
"repo": "helix", "repo": "helix",
"rev": "748a9cf022eb74e96a3697e4b11b2490b1e58f08", "rev": "84e24b33dcda16d1d64805f34dcc02d82d0de8f1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -355,11 +358,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1721135958, "lastModified": 1704809957,
"narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", "narHash": "sha256-Z8sBeoeeY2O+BNqh5C+4Z1h1F1wQ2mij7yPZ2GY397M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", "rev": "e13aa9e287b3365473e5897e3667ea80a899cdfb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -409,11 +412,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1719942949, "lastModified": 1704221387,
"narHash": "sha256-srSQac7dhXtisqu4XwPGrK8qcmT2rflJJ1mRIV9j0Qk=", "narHash": "sha256-XXsRjoz6IwMnY5MlMNi1QXqKFnJXYkIg3l/fnXn0oSs=",
"owner": "hraban", "owner": "hraban",
"repo": "mac-app-util", "repo": "mac-app-util",
"rev": "63f269f737cafb2219ba38780c1ecb1dc24bc4a2", "rev": "4f48e20f25a620c3d4ef658bb3804c849d46cc93",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -431,11 +434,11 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1717086091, "lastModified": 1704611696,
"narHash": "sha256-GmsEQa4HZeMfec37LZnwG/Lt/XmqFLXsjv5QWojeNiM=", "narHash": "sha256-4ZCgV5oHdEc3q+XaIzy//gh20uC/aSuAtMU9bsfgLZk=",
"owner": "oxalica", "owner": "oxalica",
"repo": "nil", "repo": "nil",
"rev": "ab3ddb8f063774cf7e22eb610f5ecfdb77309f3c", "rev": "059d33a24bb76d2048740bcce936362bf54b5bc9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -451,11 +454,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1721270582, "lastModified": 1704277720,
"narHash": "sha256-MdZmYPPExntE5rJu88IhJSy8Um4UyZCTXhOwvzbjDVI=", "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "a3e4a7b8ffc08c7dc1973822a77ad432e1ec3dec", "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -468,17 +471,16 @@
"nixd": { "nixd": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"flake-root": "flake-root",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1721140729, "lastModified": 1704598429,
"narHash": "sha256-f+RjBJ4BZ8Uv6QuQ/TEaA8crKP+Uw6DZXdtRY2EvwlQ=", "narHash": "sha256-HG1cl3X/oL0oNt9WhZzWrlJbDC572qzo85NGDf7K74A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixd", "repo": "nixd",
"rev": "334da32238a641c24ca7bff59d7a7d38c48fea06", "rev": "2d970a6a7b86d0f389dc47c728e38758f3460c90",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -489,11 +491,11 @@
}, },
"nixos-flake": { "nixos-flake": {
"locked": { "locked": {
"lastModified": 1721140942, "lastModified": 1702145288,
"narHash": "sha256-iEqZGdnkG+Hm0jZhS59NJwEyB6z9caVnudWPGHZ/FAE=", "narHash": "sha256-apVeRT0kOnDejwwBwbwNccm+qq1l6+qUOiRKE0vK5qk=",
"owner": "srid", "owner": "srid",
"repo": "nixos-flake", "repo": "nixos-flake",
"rev": "5734c1d9a5fe0bc8e8beaf389ad6227392ca0108", "rev": "4e422edf6b511f8e214b392cf1a0d4707a0399a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -504,11 +506,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1721116560, "lastModified": 1704842529,
"narHash": "sha256-++TYlGMAJM1Q+0nMVaWBSEvEUjRs7ZGiNQOpqbQApCU=", "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9355fa86e6f27422963132c2c9aeedb0fb963d93", "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -520,24 +522,30 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1719876945, "dir": "lib",
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", "lastModified": 1703961334,
"type": "tarball", "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" "owner": "NixOS",
"repo": "nixpkgs",
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
"type": "github"
}, },
"original": { "original": {
"type": "tarball", "dir": "lib",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" "owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs-lib_2": { "nixpkgs-lib_2": {
"locked": { "locked": {
"dir": "lib", "dir": "lib",
"lastModified": 1714253743, "lastModified": 1701253981,
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -550,16 +558,16 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1720386169, "lastModified": 1685801374,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-24.05", "ref": "nixos-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -567,6 +575,7 @@
"pre-commit": { "pre-commit": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -574,11 +583,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1721042469, "lastModified": 1704913983,
"narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", "narHash": "sha256-K/GuHFFriQhH3VPWMhm6bYelDuPyGGjGu1OF1EWUn5k=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", "rev": "b0265634df1dc584585c159b775120e637afdb41",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -625,11 +634,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1709604635, "lastModified": 1701137803,
"narHash": "sha256-le4fwmWmjGRYWwkho0Gr7mnnZndOOe4XGbLw68OvF40=", "narHash": "sha256-0LcPAdql5IhQSUXJx3Zna0dYTgdIoYO7zUrsKgiBd04=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "e86c0fb5d3a22a5f30d7f64ecad88643fe26449d", "rev": "9dd940c967502f844eacea52a61e9596268d4f70",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -650,11 +659,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1717035469, "lastModified": 1704593904,
"narHash": "sha256-MzH+yjKULH3HCRj9QCTwBvqq4LZkR0ZqRE/QfGOGC2E=", "narHash": "sha256-nDoXZDTRdgF3b4n3m011y99nYFewvOl9UpzFvP8Rb3c=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "095702e63a40e86f339d11864da9dc965b70a01e", "rev": "c36fd70a99decfa6e110c86f296a97613034a680",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -666,11 +675,11 @@
"starship-src": { "starship-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1721242568, "lastModified": 1704732905,
"narHash": "sha256-Y6KT0dTwXB6ZaU5J4eByL2NVhMYGb/wUGlilqbENhtM=", "narHash": "sha256-rmbn7MBL90eG7Bdq0pTwkihNwnorWZGNK2FsCzPmZQ4=",
"owner": "starship", "owner": "starship",
"repo": "starship", "repo": "starship",
"rev": "1ea64dd02a72675eb01a1884232a2043b32105a6", "rev": "fd32e35c3d144f361f432f9ca05bb2d9340fb949",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -724,14 +733,29 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"terminal-themes": { "terminal-themes": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1718137856, "lastModified": 1704855600,
"narHash": "sha256-1wzGUnmUiLImoJKF1Nl19Q4Mk8084w7zpYlNn59D188=", "narHash": "sha256-RV/4n8n6sHvLOUxchVaIYGC0uTvKFdSYGewzr/UOQ0s=",
"owner": "mbadolato", "owner": "mbadolato",
"repo": "iTerm2-Color-Schemes", "repo": "iTerm2-Color-Schemes",
"rev": "32cc7dfc887801b004e27d476b043ae64db51ba1", "rev": "0f6babed6b545fa953cfcd1254516399d02c91fd",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,5 +1,5 @@
{ {
description = "sloane's nix configs"; description = "mat's nix configs";
inputs = { inputs = {
# base inputs # base inputs
@ -55,25 +55,22 @@
fish-plugin-replay.flake = false; fish-plugin-replay.flake = false;
fish-plugin-fish-bang-bang.url = "github:oh-my-fish/plugin-bang-bang"; fish-plugin-fish-bang-bang.url = "github:oh-my-fish/plugin-bang-bang";
fish-plugin-fish-bang-bang.flake = false; fish-plugin-fish-bang-bang.flake = false;
fish-plugin-colored-man-pages.url = "github:PatrickF1/colored_man_pages.fish"; fish-plugin-colored-man-pages.url =
"github:PatrickF1/colored_man_pages.fish";
fish-plugin-colored-man-pages.flake = false; fish-plugin-colored-man-pages.flake = false;
}; };
outputs = outputs = { self, flake-parts, ... }@inputs:
{ self, flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ systems = [ "aarch64-darwin" "aarch64-linux" ];
"aarch64-darwin"
"aarch64-linux"
];
imports = [ imports = [
inputs.nixos-flake.flakeModule inputs.nixos-flake.flakeModule
inputs.pre-commit.flakeModule inputs.pre-commit.flakeModule
./darwin ./darwin
./home ./home
./me
./nixos ./nixos
./templates ./templates
./users
]; ];
flake = { flake = {
nixosConfigurations = { nixosConfigurations = {
@ -103,18 +100,10 @@
}; };
}; };
}; };
perSystem = perSystem = { self', pkgs, config, ... }:
{
self',
pkgs,
config,
...
}:
# formatter for this flake # formatter for this flake
let let formatter = pkgs.nixfmt;
formatter = pkgs.nixfmt-rfc-style; in {
in
{
# controls which flake inputs are updated by `nix run .#update` # controls which flake inputs are updated by `nix run .#update`
nixos-flake.primary-inputs = [ nixos-flake.primary-inputs = [
# system inputs # system inputs
@ -133,7 +122,6 @@
deadnix.enable = true; deadnix.enable = true;
nil.enable = true; nil.enable = true;
nixfmt.enable = true; nixfmt.enable = true;
nixfmt.package = pkgs.nixfmt-rfc-style;
statix.enable = true; statix.enable = true;
}; };
@ -144,7 +132,7 @@
${config.pre-commit.installationScript} ${config.pre-commit.installationScript}
echo 1>&2 "\(^^)/ welcome to the flake \(^^)/" echo 1>&2 "\(^^)/ welcome to the flake \(^^)/"
''; '';
buildInputs = [ formatter ] ++ config.pre-commit.settings.enabledPackages; buildInputs = [ formatter ];
}; };
inherit formatter; inherit formatter;
}; };

10
home/copy-apps.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, lib, ... }:
let mac-app-util = lib.getExe' pkgs.mac-app-util "mac-app-util";
in {
home.activation.trampolineApps = lib.mkIf pkgs.stdenv.isDarwin
(lib.hm.dag.entryAfter [ "writeBoundary" ] ''
fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines"
${mac-app-util} sync-trampolines "$fromDir" "$toDir"
'');
}

View File

@ -1,10 +1,11 @@
{ self, ... }: { self, ... }: {
{
flake.homeModules = { flake.homeModules = {
common = { common = {
home.enableNixpkgsReleaseCheck = true; home.enableNixpkgsReleaseCheck = true;
home.stateVersion = "22.05"; home.stateVersion = "22.05";
imports = [ imports = [
# fix app copying on darwin
./copy-apps.nix
# misc file configuration # misc file configuration
./files.nix ./files.nix
# misc program configuration # misc program configuration

View File

@ -1,17 +1,12 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
let let
cfg = config.programs.helix; cfg = config.programs.helix;
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
in in {
{
options.programs.helix = { options.programs.helix = {
autoTheme = { autoTheme = {
enable = lib.mkEnableOption "Automatically switch helix theme with night mode"; enable =
lib.mkEnableOption "Automatically switch helix theme with night mode";
light = lib.mkOption { light = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -27,18 +22,17 @@ in
config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) { config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) {
xdg.configFile = { xdg.configFile = {
"helix/light.toml".source = tomlFormat.generate "helix-autotheme" ( "helix/light.toml".source = tomlFormat.generate "helix-autotheme"
cfg.settings // { theme = cfg.autoTheme.light; } (cfg.settings // { theme = cfg.autoTheme.light; });
); "helix/dark.toml".source = tomlFormat.generate "helix-autotheme"
"helix/dark.toml".source = tomlFormat.generate "helix-autotheme" ( (cfg.settings // { theme = cfg.autoTheme.dark; });
cfg.settings // { theme = cfg.autoTheme.dark; }
);
}; };
programs.fish.functions = { programs.fish.functions = {
hx = { hx = {
wraps = "hx"; wraps = "hx";
description = "Helix invocation wrapper to automatically select the right theme"; description =
"Helix invocation wrapper to automatically select the right theme";
body = '' body = ''
if is-dark-mode if is-dark-mode
command hx --config ${config.xdg.configHome}/helix/dark.toml $argv command hx --config ${config.xdg.configHome}/helix/dark.toml $argv

View File

@ -1,9 +1,4 @@
{ { config, pkgs, lib, ... }:
config,
pkgs,
lib,
...
}:
let let
cfg = config.programs.kitty; cfg = config.programs.kitty;
# helper scripts for changing kitty colors # helper scripts for changing kitty colors
@ -21,8 +16,7 @@ let
term-dark = pkgs.writeShellScriptBin "term-dark" '' term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name} ${term-background}/bin/term-background ${cfg.colors.dark-name}
''; '';
in in {
{
options.programs.kitty = { options.programs.kitty = {
colors = { colors = {
enable = lib.mkOption { enable = lib.mkOption {
@ -70,17 +64,14 @@ in
}; };
config = lib.mkIf (cfg.enable && cfg.colors.enable) { config = lib.mkIf (cfg.enable && cfg.colors.enable) {
home.packages = [ home.packages = [ term-light term-dark term-background ];
term-light
term-dark
term-background
];
programs.kitty.settings = { programs.kitty.settings = {
allow_remote_control = "yes"; allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty"; listen_on = "unix:/tmp/mykitty";
}; };
xdg.configFile."kitty/macos-launch-services-cmdline".text = lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty"; xdg.configFile."kitty/macos-launch-services-cmdline".text =
lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty";
}; };
} }

View File

@ -1,8 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
let let cfg = config.programs.kitty;
cfg = config.programs.kitty; in {
in
{
options.programs.kitty = { options.programs.kitty = {
useSymbolsFromNerdFont = lib.mkOption { useSymbolsFromNerdFont = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -21,7 +19,8 @@ in
config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") { config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") {
programs.kitty.settings = { programs.kitty.settings = {
# https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points # https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points
symbol_map = "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}"; symbol_map =
"U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}";
}; };
}; };
} }

View File

@ -1,166 +1,158 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let nixConfigDirectory = "~/dotfiles.nix";
nixConfigDirectory = "~/dotfiles.nix"; in {
in
{
programs.fish = { programs.fish = {
enable = true; enable = true;
# see flake.nix and pkgs/default.nix # see flake.nix and pkgs/default.nix
plugins = pkgs.fishPlugins.flakePlugins; plugins = pkgs.fishPlugins.flakePlugins;
functions = functions = {
{ # user functions
# user functions mkdcd = {
mkdcd = { argumentNames = [ "target" ];
argumentNames = [ "target" ]; body = ''
body = '' if test -z "$target"
if test -z "$target" echo "mkdcd requires an argument" 1>&2
echo "mkdcd requires an argument" 1>&2 return 1
return 1 end
end mkdir -p $target
mkdir -p $target cd $target
cd $target
'';
};
from-dir = {
argumentNames = [ "dir" ];
body = ''
pushd $dir
set -e argv[1]
$argv
popd
'';
};
darwin-rebuild-edit-with = {
argumentNames = [
"editor"
"file"
];
body = ''
if test -z "$file"
set file flake.nix
end
from-nix $editor $file
'';
};
# TODO: use these to implement !! and .. abbreviations
# blocked on additional support for abbr in home-manager
# https://github.com/nix-community/home-manager/issues/3706
#
# taken from
# https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023
# last-history-item.body = ''
# echo $history[1]
# '';
# multi-cd.body = ''
# echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
# '';
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
# light/dark mode helpers
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
''; '';
};
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this from-dir = {
# variable changes. we use a universal variable so that all instances of Fish have the same argumentNames = [ "dir" ];
# value for the variable. body = ''
toggle-background.body = '' pushd $dir
set -e argv[1]
$argv
popd
'';
};
darwin-rebuild-edit-with = {
argumentNames = [ "editor" "file" ];
body = ''
if test -z "$file"
set file flake.nix
end
from-nix $editor $file
'';
};
# TODO: use these to implement !! and .. abbreviations
# blocked on additional support for abbr in home-manager
# https://github.com/nix-community/home-manager/issues/3706
#
# taken from
# https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023
# last-history-item.body = ''
# echo $history[1]
# '';
# multi-cd.body = ''
# echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
# '';
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# light/dark mode helpers
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
# variable changes. we use a universal variable so that all instances of Fish have the same
# value for the variable.
toggle-background.body = ''
if test "$term_background" = light
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-macOS.body = ''
if is-dark-mode
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
set -U term_background dark
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light if test "$term_background" = light
set -U term_background dark alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else else
set -U term_background light alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
end end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
''; '';
onVariable = "term_background";
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-macOS.body = ''
if is-dark-mode
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
set -U term_background dark
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else
alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
'';
onVariable = "term_background";
};
}; };
};
shellAbbrs = shellAbbrs = {
{ ".." = "cd ..";
".." = "cd ..";
# darwin-rebuild build # darwin-rebuild build
drb = "from-nix darwin-rebuild build --flake ."; drb = "from-nix darwin-rebuild build --flake .";
# darwin-rebuild switch full # darwin-rebuild switch full
drsf = "from-nix darwin-rebuild switch --flake ."; drsf = "from-nix darwin-rebuild switch --flake .";
# darwin-rebuild switch (no homebrew) # darwin-rebuild switch (no homebrew)
drs = "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false"; drs =
# edit darwin-rebuild config in helix "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false";
drh = "darwin-rebuild-edit-with hx"; # edit darwin-rebuild config in helix
# edit darwin-rebuild config in zed drh = "darwin-rebuild-edit-with hx";
drz = "zed ${nixConfigDirectory}"; # edit darwin-rebuild config in zed
drz = "zed ${nixConfigDirectory}";
nb = "nix build"; nb = "nix build";
nd = "nix develop"; nd = "nix develop";
nf = "nix flake"; nf = "nix flake";
nfc = "nix flake check"; nfc = "nix flake check";
nfi = "nix flake init"; nfi = "nix flake init";
nfs = "nix flake show"; nfs = "nix flake show";
nfu = "nix flake update"; nfu = "nix flake update";
nr = "nix run"; nr = "nix run";
ns = "nix search nixpkgs"; ns = "nix search nixpkgs";
nsh = "nix shell"; nsh = "nix shell";
nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'"; nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'";
g = "git"; g = "git";
ga = "git add"; ga = "git add";
gc = "git commit"; gc = "git commit";
gd = "git diff"; gd = "git diff";
gl = "git log"; gl = "git log";
gp = "git push"; gp = "git push";
stage = "git add ."; stage = "git add .";
commit = "git commit"; commit = "git commit";
push = "git push"; push = "git push";
pull = "git pull"; pull = "git pull";
} } // lib.optionalAttrs pkgs.stdenv.isDarwin {
// lib.optionalAttrs pkgs.stdenv.isDarwin { tb = "toggle-background";
tb = "toggle-background"; sb = "set-background-to-macOS";
sb = "set-background-to-macOS"; };
};
shellAliases = { shellAliases = {
# nix related # nix related

View File

@ -1,43 +1,33 @@
{ { flake, pkgs, lib, ... }: {
flake,
pkgs,
lib,
...
}:
{
imports = [ flake.inputs.ghostty.homeModules.default ]; imports = [ flake.inputs.ghostty.homeModules.default ];
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
# ghostty is externally managed for now # ghostty is externally managed for now
package = null; package = null;
settings = settings = let font = "RecMonoDuotone Nerd Font";
let in {
font = "RecMonoDuotone Nerd Font"; # TODO: auto-theme
in config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine" ];
{ font-family = font;
# TODO: auto-theme # font-family-bold = "${font} Bold";
config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine-dawn" ]; # font-family-italic = "${font} Italic";
font-family = font; # font-family-bold-italic = "${font} Bold Italic";
# font-family-bold = "${font} Bold"; # font-codepoint-map =
# font-family-italic = "${font} Italic"; # "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D=RecMonoDuotone Nerd Font";
# font-family-bold-italic = "${font} Bold Italic"; font-size = 15;
# font-codepoint-map = background-opacity = 0.95;
# "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D=RecMonoDuotone Nerd Font"; unfocused-split-opacity = 0.8;
font-size = 15; window-decoration = true;
background-opacity = 0.95; window-padding-x = 10;
unfocused-split-opacity = 0.8; window-padding-y = 10;
window-decoration = true; window-inherit-working-directory = false;
window-padding-x = 10; working-directory = "home";
window-padding-y = 10; } // lib.optionalAttrs pkgs.stdenv.isDarwin {
window-inherit-working-directory = false; copy-on-select = "clipboard";
working-directory = "home"; background-blur-radius = 20;
} macos-non-native-fullscreen = "visible-menu";
// lib.optionalAttrs pkgs.stdenv.isDarwin { macos-option-as-alt = true;
copy-on-select = "clipboard"; };
background-blur-radius = 20;
macos-non-native-fullscreen = "visible-menu";
macos-option-as-alt = true;
};
}; };
} }

View File

@ -1,13 +1,11 @@
{ flake, ... }: { flake, ... }:
let let inherit (flake.config.users) me';
inherit (flake.config) me; in {
in
{
programs.git = { programs.git = {
enable = true; enable = true;
userEmail = me.email; userEmail = me'.email;
userName = me.name; userName = me'.name;
extraConfig = { extraConfig = {
help.autocorrect = "prompt"; help.autocorrect = "prompt";
@ -19,11 +17,7 @@ in
merge.conflictStyle = "diff3"; merge.conflictStyle = "diff3";
}; };
ignores = [ ignores = [ ".DS_Store" ".direnv" "result" ];
".DS_Store"
".direnv"
"result"
];
# enhanced diffs # enhanced diffs
# TODO: fix light colorscheme # TODO: fix light colorscheme

View File

@ -1,5 +1,4 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }: {
{
imports = [ ./extras/helix/auto-theme.nix ]; imports = [ ./extras/helix/auto-theme.nix ];
programs.helix = { programs.helix = {
enable = true; enable = true;

View File

@ -1,12 +1,7 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let font = "Rec Mono Duotone";
font = "Rec Mono Duotone"; in {
in imports = [ ./extras/kitty/auto-theme.nix ./extras/kitty/nerd-font.nix ];
{
imports = [
./extras/kitty/auto-theme.nix
./extras/kitty/nerd-font.nix
];
programs.kitty = { programs.kitty = {
enable = true; enable = true;
# using kitty from homebrew # using kitty from homebrew
@ -34,7 +29,9 @@ in
# shell integration is manually enabled for fish # shell integration is manually enabled for fish
shell_integration = "disabled"; shell_integration = "disabled";
} // lib.optionalAttrs pkgs.stdenv.isDarwin { macos_option_as_alt = "both"; }; } // lib.optionalAttrs pkgs.stdenv.isDarwin {
macos_option_as_alt = "both";
};
useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font"; useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font";
colors = { colors = {

View File

@ -1,18 +1,17 @@
{ flake, pkgs, ... }: { flake, pkgs, ... }:
let let
inherit (flake.config) me; inherit (flake.config.users) me me';
tomlFormat = pkgs.formats.toml { }; tomlFormat = pkgs.formats.toml { };
in in {
{
home = { home = {
packages = [ pkgs.pijul ]; packages = [ pkgs.pijul ];
file = { file = {
# hardcode .config because pijul doesn't support XDG (yet?) # hardcode .config because pijul doesn't support XDG (yet?)
".config/pijul/config.toml".source = tomlFormat.generate "pijul-config" { ".config/pijul/config.toml".source = tomlFormat.generate "pijul-config" {
author = { author = {
name = me.username; name = me;
full_name = me.name; full_name = me'.name;
inherit (me) email; inherit (me') email;
}; };
}; };
}; };

View File

@ -1,97 +1,88 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }: {
{
home.packages = builtins.attrValues ( home.packages = builtins.attrValues ({
{ inherit (pkgs)
inherit (pkgs) # GUI apps
# system tools discord-ptb obsidian rectangle slack utm zoom-us
curl
wget
# `tmux` session alternative
abduco
# archive tool
atool
# `top` alternative with ASCII graphs
bottom
# `ncdu` alternative
diskonaut
# `dig` alternative. dogs _can_ look up
dogdns
# `du` alternative
du-dust
# `find` alternative
fd
# `ping` with a graph
gping
# `ps` alternative
procs
# pipe progress viewer
pv
# command line file encryption
rage
# `sed` alternative for _batch file_ edits
sad
# `sed` alternative for _stream_ edits
sd
# backups for the truly paranoid
tarsnap
# terminal color support testing
terminal-colors
# (La)TeX alternative
typst
# extract RAR archives
unrar
# extract XZ archives
xz
# `tmux` multiplexing/layout alternative
zellij
# dev platforms # system tools
# command line tools for fly.io curl wget
flyctl # `tmux` session alternative
# command line tools for netlify abduco
netlify-cli # archive tool
atool
# `top` alternative with ASCII graphs
bottom
# `ncdu` alternative
diskonaut
# `dig` alternative. dogs _can_ look up
dogdns
# `du` alternative
du-dust
# `find` alternative
fd
# `ping` with a graph
gping
# `ps` alternative
procs
# pipe progress viewer
pv
# command line file encryption
rage
# `sed` alternative for _batch file_ edits
sad
# `sed` alternative for _stream_ edits
sd
# backups for the truly paranoid
tarsnap
# terminal color support testing
terminal-colors
# (La)TeX alternative
typst
# extract RAR archives
unrar
# extract XZ archives
xz
# `tmux` multiplexing/layout alternative
zellij
# dev tools # dev platforms
# session recording # command line tools for fly.io
asciinema flyctl
# benchmarking tool # command line tools for netlify
hyperfine netlify-cli
# task runner
just
# source code line counter
tokei
# reimplementation of `httpie` in rust
xh
# useful nix related tools # dev tools
nix-prefetch-git # session recording
nix-tree asciinema
nixfmt-rfc-style # benchmarking tool
# adding/managing alternative binary caches hosted by Cachix hyperfine
cachix # task runner
# run software from nixpkgs without installing it just
comma # source code line counter
# nix language servers tokei
nil # reimplementation of `httpie` in rust
nixd xh
;
} # useful nix related tools
// lib.optionalAttrs pkgs.stdenv.isDarwin { nix-prefetch-git nix-tree
inherit (pkgs) # adding/managing alternative binary caches hosted by Cachix
# useful macOS CLI commands cachix
m-cli # run software from nixpkgs without installing it
; comma
} # nix language servers
); nil nixd;
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
inherit (pkgs)
# useful macOS CLI commands
m-cli;
});
programs = { programs = {
# `cat` with wings # `cat` with wings
bat = { bat = {
enable = true; enable = true;
config = { config = { style = "auto"; };
style = "auto";
};
}; };
# multi-shell / multi-command argument completion daemon # multi-shell / multi-command argument completion daemon
carapace.enable = true; carapace.enable = true;
@ -103,6 +94,7 @@
# fork of `exa`, an `ls` alternative # fork of `exa`, an `ls` alternative
eza = { eza = {
enable = true; enable = true;
enableAliases = true;
icons = true; icons = true;
git = true; git = true;
extraOptions = [ "--group-directories-first" ]; extraOptions = [ "--group-directories-first" ];

View File

@ -1,16 +1,8 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
# dark-mode-notify configuration # dark-mode-notify configuration
launchd.agents.dark-mode-notify = launchd.agents.dark-mode-notify =
let let logPath = "${config.xdg.stateHome}/dark-mode-notify";
logPath = "${config.xdg.stateHome}/dark-mode-notify"; in {
in
{
enable = true; enable = true;
config = { config = {
Label = "ke.bou.dark-mode-notify"; Label = "ke.bou.dark-mode-notify";

View File

@ -1,10 +1,4 @@
{ { config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{
# set configuration in ~ so tarsnap cli works interactively # set configuration in ~ so tarsnap cli works interactively
home.file.".tarsnaprc".text = '' home.file.".tarsnaprc".text = ''
cachedir ${config.xdg.cacheHome} cachedir ${config.xdg.cacheHome}
@ -15,36 +9,32 @@
humanize-numbers humanize-numbers
''; '';
# tarsnap periodic backup configuration # tarsnap periodic backup configuration
launchd.agents.tarsnap = launchd.agents.tarsnap = let
let logPath = "${config.xdg.stateHome}/tarsnap";
logPath = "${config.xdg.stateHome}/tarsnap"; tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" ''
tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" '' date=$(date -u +%Y-%m-%dT%H:%M:%SZ)
date=$(date -u +%Y-%m-%dT%H:%M:%SZ) echo
echo echo "Running tarsnap backup for $date"
echo "Running tarsnap backup for $date" ${lib.getExe pkgs.tarsnap} -c \
${lib.getExe pkgs.tarsnap} -c \ --configfile ${config.home.homeDirectory}/.tarsnaprc \
--configfile ${config.home.homeDirectory}/.tarsnaprc \ --keyfile ${config.xdg.configHome}/tarsnap/write-only.key \
--keyfile ${config.xdg.configHome}/tarsnap/write-only.key \ -f $(uname -n)-$date \
-f $(uname -n)-$date \ ${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents}
${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents} '';
''; in {
in enable = true;
{ config = {
enable = true; Label = "com.tarsnap.tarsnap";
config = { StandardErrorPath = "${logPath}/error.log";
Label = "com.tarsnap.tarsnap"; StandardOutPath = "${logPath}/out.log";
StandardErrorPath = "${logPath}/error.log"; StartCalendarInterval = [{
StandardOutPath = "${logPath}/out.log"; # every sunday
StartCalendarInterval = [ Weekday = 0;
{ # at midnight
# every sunday Hour = 0;
Weekday = 0; Minute = 0;
# at midnight }];
Hour = 0; Program = lib.getExe tarsnapBackup;
Minute = 0;
}
];
Program = lib.getExe tarsnapBackup;
};
}; };
};
} }

View File

@ -1,13 +1,8 @@
{ { config, lib, pkgs, ... }:
config,
lib,
pkgs,
...
}:
let let
socket = "${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh"; socket =
in "${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
{ in {
home.sessionVariables.SSH_AUTH_SOCK = socket; home.sessionVariables.SSH_AUTH_SOCK = socket;
programs.ssh = { programs.ssh = {
enable = true; enable = true;

View File

@ -2,12 +2,10 @@
programs.starship = { programs.starship = {
enable = true; enable = true;
settings = { settings = {
battery.display = [ battery.display = [{
{ # display battery information if charge is <= 25%
# display battery information if charge is <= 25% threshold = 25;
threshold = 25; }];
}
];
# turn on fish directory truncation # turn on fish directory truncation
directory.fish_style_pwd_dir_length = 1; directory.fish_style_pwd_dir_length = 1;
# number of directories not to truncate # number of directories not to truncate

View File

@ -1,9 +0,0 @@
{
name = "sloane ess";
username = "sloane";
email = "sloane@sloane.lol";
sshKeys = [
# secretive
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= sloane"
];
}

View File

@ -1,33 +0,0 @@
{ lib, ... }:
let
userSubmodule = lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = ''
full name
'';
};
username = lib.mkOption {
type = lib.types.str;
description = ''
user account name
'';
};
email = lib.mkOption { type = lib.types.str; };
sshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = ''
SSH public keys
'';
};
};
};
in
{
options.me = lib.mkOption { type = userSubmodule; };
# TODO: currently multiplexing this on the work branch
# how can we vary the config username based on the hostname?
# e.g. https://github.com/srid/nixos-flake/discussions/22#discussioncomment-5909499
config.me = import ./config.nix;
}

View File

@ -1,25 +1,16 @@
{ self, config, ... }: { self, config, ... }: {
{
flake.nixosModules = { flake.nixosModules = {
common.imports = [ common.imports = [ ./nix.nix ./caches ];
./nix.nix
./caches
];
home = home = let inherit (config.users) me;
let in {
inherit (config.me) username; home-manager.users.${me} = { imports = [ self.homeModules.linux ]; };
in users.users.${me} = {
{ name = me;
home-manager.users.${username} = { home = "/home/${me}";
imports = [ self.homeModules.linux ]; isNormalUser = true;
};
users.users.${username} = {
name = username;
home = "/home/${username}";
isNormalUser = true;
};
}; };
};
default.imports = [ default.imports = [
self.nixosModules.home-manager self.nixosModules.home-manager

View File

@ -1,10 +1,4 @@
{ { flake, pkgs, lib, ... }: {
flake,
pkgs,
lib,
...
}:
{
nixpkgs = { nixpkgs = {
config = { config = {
allowBroken = true; allowBroken = true;
@ -20,9 +14,12 @@
}; };
nix = { nix = {
package = pkgs.nixUnstable;
nixPath = { nixPath = {
nixpkgs = "${flake.inputs.nixpkgs}"; nixpkgs = "${flake.inputs.nixpkgs}";
} // lib.optionalAttrs pkgs.stdenv.isDarwin { darwin = "${flake.inputs.nix-darwin}"; }; } // lib.optionalAttrs pkgs.stdenv.isDarwin {
darwin = "${flake.inputs.nix-darwin}";
};
registry = { registry = {
nixpkgs.flake = flake.inputs.nixpkgs; nixpkgs.flake = flake.inputs.nixpkgs;
self.flake = flake.inputs.self; self.flake = flake.inputs.self;
@ -30,23 +27,15 @@
settings = { settings = {
# TODO: automatic optimizing and gc # TODO: automatic optimizing and gc
# https://github.com/montchr/dotfield/blob/main/profiles/darwinProfiles/core/nix-optimizations-darwin.nix # https://github.com/montchr/dotfield/blob/main/profiles/darwinProfiles/core/nix-optimizations-darwin.nix
experimental-features = [ experimental-features = [ "nix-command" "flakes" "repl-flake" ];
"nix-command"
"flakes"
"repl-flake"
];
extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [ extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
# wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9 # wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}''; flake-registry = builtins.toFile "empty-flake-registry.json"
trusted-users = [ ''{"flakes":[],"version":2}'';
flake.config.me.username trusted-users = [ flake.config.users.me "root" "@admin" "@wheel" ];
"root"
"@admin"
"@wheel"
];
}; };
}; };
} }

View File

@ -1,13 +1,10 @@
{ flake, ... }: { flake, ... }: {
{
# remote access # remote access
users.users = users.users = let
let inherit (flake.config.users) me me';
inherit (flake.config) me; myKeys = me'.sshKeys;
myKeys = me.sshKeys; in {
in root.openssh.authorizedKeys.keys = myKeys;
{ ${me}.openssh.authorizedKeys.keys = myKeys;
root.openssh.authorizedKeys.keys = myKeys; };
${me.username}.openssh.authorizedKeys.keys = myKeys;
};
} }

View File

@ -1,16 +1,10 @@
{ { stdenv, lib, xcodeenv, dark-mode-notify-src }:
stdenv,
lib,
xcodeenv,
dark-mode-notify-src,
}:
let let
xcode = xcodeenv.composeXcodeWrapper { xcode = xcodeenv.composeXcodeWrapper {
version = "*.*"; version = "*.*";
xcodeBaseDir = "/Applications/Xcode.app"; xcodeBaseDir = "/Applications/Xcode.app";
}; };
in in stdenv.mkDerivation {
stdenv.mkDerivation {
pname = "dark-mode-notify"; pname = "dark-mode-notify";
version = dark-mode-notify-src.shortRev; version = dark-mode-notify-src.shortRev;

View File

@ -2,24 +2,24 @@ inputs: self: super: {
inherit (inputs) terminal-themes; inherit (inputs) terminal-themes;
# get flake inputs prefixed with fish-plugin- and inject them into fishPlugins as a single list # get flake inputs prefixed with fish-plugin- and inject them into fishPlugins as a single list
fishPlugins = super.fishPlugins // { fishPlugins = super.fishPlugins // {
flakePlugins = flakePlugins = let
let srcs =
srcs = self.lib.filterAttrs (input: _: self.lib.hasPrefix "fish-plugin-" input) inputs; self.lib.filterAttrs (input: _: self.lib.hasPrefix "fish-plugin-" input)
in inputs;
self.lib.mapAttrsToList (input: src: { in self.lib.mapAttrsToList (input: src: {
name = self.lib.removePrefix "fish-plugin-" input; name = self.lib.removePrefix "fish-plugin-" input;
inherit src; inherit src;
}) srcs; }) srcs;
}; };
ia-writer-family = self.callPackage ./ia-writer-family.nix { ia-writer-family = self.callPackage ./ia-writer-family.nix {
inherit (inputs) ia-writer-family-src; inherit (inputs) ia-writer-family-src;
}; };
mac-app-util = inputs.mac-app-util.packages.${super.stdenv.system}.default.overrideAttrs (old: { mac-app-util =
postInstall = inputs.mac-app-util.packages.${super.stdenv.system}.default.overrideAttrs
old.postInstall (old: {
+ '' postInstall = old.postInstall + ''
wrapProgram "$out/bin/mac-app-util" --suffix PATH : "${super.jq}/bin" wrapProgram "$out/bin/mac-app-util" --suffix PATH : "${super.jq}/bin"
''; '';
}); });
recursive-patched = self.callPackage ./recursive-patched.nix { }; recursive-patched = self.callPackage ./recursive-patched.nix { };
} }

View File

@ -1,8 +1,4 @@
{ { stdenv, lib, ia-writer-family-src }:
stdenv,
lib,
ia-writer-family-src,
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "ia-writer-family"; pname = "ia-writer-family";
version = ia-writer-family-src.shortRev; version = ia-writer-family-src.shortRev;

View File

@ -1,8 +1,4 @@
{ { stdenv, nerd-font-patcher, recursive }:
stdenv,
nerd-font-patcher,
recursive,
}:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "recursive-nerd-font-patched"; name = "recursive-nerd-font-patched";
src = recursive; src = recursive;

View File

@ -1,20 +1,14 @@
{ pkgs, lib, ... }: { pkgs, ... }: {
{
environment.systemPackages = [ pkgs.terminal-notifier ]; environment.systemPackages = [ pkgs.terminal-notifier ];
# networking settings # networking settings
# TODO: do we need to add Tailscale, ProtonVPN, RNDIS (reMarkable), etc? # TODO: do we need to add Tailscale, ProtonVPN, RNDIS (reMarkable), etc?
networking.knownNetworkServices = [ networking.knownNetworkServices =
"USB 10/100/1000 LAN" [ "USB 10/100/1000 LAN" "Wi-Fi" "Thunderbolt Bridge" ];
"Wi-Fi"
"Thunderbolt Bridge"
];
# TODO: where / how to configure hostname etc? # TODO: where / how to configure hostname etc?
# manage build users, package, and daemon # manage build users, package, and daemon
nix.configureBuildUsers = true; nix.configureBuildUsers = true;
# https://github.com/LnL7/nix-darwin/issues/970#issuecomment-2165447526
ids.uids.nixbld = lib.mkForce 30000;
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
# use TouchID for sudo authentication # use TouchID for sudo authentication

View File

@ -1,20 +1,14 @@
{ lib, ... }: { lib, ... }: {
{ homebrew.casks = [ "itsycal" "pallotron-yubiswitch" ];
homebrew.casks = [ home-manager.sharedModules = [{
"itsycal" launchd.agents.tarsnap.enable = lib.mkForce false;
"pallotron-yubiswitch" programs.ssh.matchBlocks.devbox = {
]; hostname = "csdev6";
home-manager.sharedModules = [ forwardAgent = true;
{ serverAliveInterval = 120;
launchd.agents.tarsnap.enable = lib.mkForce false; };
programs.ssh.matchBlocks.devbox = { programs.fish.functions.devbox.body = ''
hostname = "csdev6"; ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
forwardAgent = true; '';
serverAliveInterval = 120; }];
};
programs.fish.functions.devbox.body = ''
ssh -t devbox "agenttmux attach; or agenttmux new -s yelp"
'';
}
];
} }

View File

@ -1,5 +1,4 @@
{ flake, ... }: { flake, ... }: {
{
imports = [ flake.inputs.disko.nixosModules.disko ]; imports = [ flake.inputs.disko.nixosModules.disko ];
disko.devices.disk = { }; disko.devices.disk = { };

View File

@ -10,45 +10,26 @@
pre-commit.inputs.nixpkgs.follows = "nixpkgs"; pre-commit.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs = inputs@{ self, flake-parts, crane, pre-commit, ... }:
inputs@{
self,
flake-parts,
crane,
pre-commit,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ pre-commit.flakeModule ]; imports = [ pre-commit.flakeModule ];
systems = [ systems =
"aarch64-darwin" [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ];
"aarch64-linux" perSystem = { config, pkgs, system, ... }:
"x86_64-darwin"
"x86_64-linux"
];
perSystem =
{
config,
pkgs,
system,
...
}:
let let
crane-lib = crane.lib.${system}; crane-lib = crane.lib.${system};
package = crane-lib.buildPackage { package = crane-lib.buildPackage {
src = crane-lib.cleanCargoSource ./.; src = crane-lib.cleanCargoSource ./.;
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ]; nativeBuildInputs =
pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
}; };
in in {
{
pre-commit.settings.hooks = { pre-commit.settings.hooks = {
rustfmt.enable = true; rustfmt.enable = true;
clippy.enable = true; clippy.enable = true;
cargo-check.enable = true; cargo-check.enable = true;
}; };
checks = { checks = { inherit package; };
inherit package;
};
packages.default = package; packages.default = package;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
shellHook = '' shellHook = ''
@ -57,9 +38,13 @@
''; '';
inputsFrom = builtins.attrValues self.checks; inputsFrom = builtins.attrValues self.checks;
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; RUST_SRC_PATH =
nativeBuildInputs = builtins.attrValues { inherit (pkgs) cargo rustc; }; "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
buildInputs = builtins.attrValues { inherit (pkgs) rust-analyzer rustfmt clippy; }; nativeBuildInputs =
builtins.attrValues { inherit (pkgs) cargo rustc; };
buildInputs = builtins.attrValues {
inherit (pkgs) rust-analyzer rustfmt clippy;
};
}; };
}; };
}; };

22
users/config.nix Normal file
View File

@ -0,0 +1,22 @@
{
me = "mat";
users = {
mat = {
name = "mat ess";
email = "mat@mat.services";
sshKeys = [
# secretive
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= mat"
];
};
mess = {
name = "Matthew Ess";
email = "mess@yelp.com";
sshKeys = [
# secretive
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLWD/lvxFOdmE48MUKdigYZOAc3bSIyPxW4M7frWe8Nks9cr58Z/1btvUUmAK+u+J6gw5g+Mt9X0uwR7KPQlavg= mat"
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOkqyHm9fBDXChdmNgbhxd2U1IpkiD4xjC8AVOvil+uEeKYqDi5mF3oeAGYJrV6BRc7hEO+DQP60pN0wI5tMoYE= yelp"
];
};
};
}

48
users/default.nix Normal file
View File

@ -0,0 +1,48 @@
{ config, lib, ... }:
let
userSubmodule = lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = ''
full name
'';
};
email = lib.mkOption { type = lib.types.str; };
sshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = ''
SSH public keys
'';
};
};
};
usersSubmodule = lib.types.submodule {
options = {
users = lib.mkOption { type = lib.types.attrsOf userSubmodule; };
me = lib.mkOption {
type = lib.types.str;
description = ''
The name of the user that represents me.
Admin user in all contexts.
Should be a key into the `users` attribute set.
'';
};
me' = lib.mkOption {
type = userSubmodule;
description = ''
The rest of the user data for `me`.
'';
readOnly = true;
};
};
};
in {
# TODO: can we hack in an assertion that `me` is a key in `users`?
options.users = lib.mkOption { type = usersSubmodule; };
config.users = (import ./config.nix) // {
me' = lib.mkDefault config.users.users.${config.users.me};
};
}