summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Schanzenbacher <ryan@rschanz.org>2025-04-01 11:26:04 -0400
committerRyan Schanzenbacher <ryan@rschanz.org>2025-04-01 11:26:04 -0400
commitd465e92647470759177cb63914fd3571cea7a8a4 (patch)
treec2a27471bd33c7e3e53688c89758544664b89ac0
parent365a13de3e19c66f6bb2ffb806e8086a068ffc25 (diff)
Using Zen, added nix update to be upstreamed
-rw-r--r--home-config/nix-home-manager/firefox-nightly/default.nix9
-rw-r--r--home-config/nix-home-manager/flake.lock108
-rw-r--r--home-config/nix-home-manager/flake.nix13
-rw-r--r--home-config/nix-home-manager/home.nix26
-rw-r--r--home-config/nix-home-manager/zenPolicies.nix126
-rw-r--r--modules/ryan-packages/package-management.scm233
-rw-r--r--modules/ryan-services/nix.scm182
7 files changed, 663 insertions, 34 deletions
diff --git a/home-config/nix-home-manager/firefox-nightly/default.nix b/home-config/nix-home-manager/firefox-nightly/default.nix
index cffaa1d..b86da78 100644
--- a/home-config/nix-home-manager/firefox-nightly/default.nix
+++ b/home-config/nix-home-manager/firefox-nightly/default.nix
@@ -1,17 +1,16 @@
1{ config, pkgs, mozff, ...}: 1{ config, pkgs, zen-browser, ...}:
2 2
3let 3let
4 4
5wrapped-ff-nightly = mozff.packages.${pkgs.system}.firefox-nightly-bin.override { 5#wrapped-ff-nightly = zen-browser.packages.${pkgs.system}.default
6 extraPolicies = import ./policies.nix;
7};
8 6
9in 7in
10 8
11{ 9{
12 programs.firefox = { 10 programs.firefox = {
13 enable = true; 11 enable = true;
14 #package = wrapped-ff-nightly; 12 policies = import ./policies.nix;
13 #package = zen-browser.packages.${pkgs.system}.default.unwrapped;
15 14
16 profiles.${config.home.username} = { 15 profiles.${config.home.username} = {
17 name = "${config.home.username}"; 16 name = "${config.home.username}";
diff --git a/home-config/nix-home-manager/flake.lock b/home-config/nix-home-manager/flake.lock
index a0c7e15..0eebe5d 100644
--- a/home-config/nix-home-manager/flake.lock
+++ b/home-config/nix-home-manager/flake.lock
@@ -297,26 +297,24 @@
297 "hyprland-protocols": "hyprland-protocols", 297 "hyprland-protocols": "hyprland-protocols",
298 "hyprland-qtutils": "hyprland-qtutils", 298 "hyprland-qtutils": "hyprland-qtutils",
299 "hyprlang": "hyprlang", 299 "hyprlang": "hyprlang",
300 "hyprutils": "hyprutils", 300 "hyprutils": "hyprutils_2",
301 "hyprwayland-scanner": "hyprwayland-scanner", 301 "hyprwayland-scanner": "hyprwayland-scanner",
302 "nixpkgs": [ 302 "nixpkgs": "nixpkgs",
303 "nixpkgs"
304 ],
305 "pre-commit-hooks": "pre-commit-hooks", 303 "pre-commit-hooks": "pre-commit-hooks",
306 "systems": "systems", 304 "systems": "systems",
307 "xdph": "xdph" 305 "xdph": "xdph"
308 }, 306 },
309 "locked": { 307 "locked": {
310 "lastModified": 1738457237, 308 "lastModified": 1742741773,
311 "narHash": "sha256-9mtM+lwnmXnv5TPmdij1rR5fLzzqSjkltcyEuRf8uIk=", 309 "narHash": "sha256-SLEd12Y9KzlQd4CfH2+gz3oQvkPKmwvwi74O+veNdbs=",
312 "owner": "hyprwm", 310 "owner": "hyprwm",
313 "repo": "hyprland", 311 "repo": "hyprland",
314 "rev": "882f7ad7d2bbfc7440d0ccaef93b1cdd78e8e3ff", 312 "rev": "5ee35f914f921e5696030698e74fb5566a804768",
315 "type": "github" 313 "type": "github"
316 }, 314 },
317 "original": { 315 "original": {
318 "owner": "hyprwm", 316 "owner": "hyprwm",
319 "ref": "v0.47.2", 317 "ref": "v0.48.0",
320 "repo": "hyprland", 318 "repo": "hyprland",
321 "type": "github" 319 "type": "github"
322 } 320 }
@@ -348,10 +346,7 @@
348 }, 346 },
349 "hyprland-qtutils": { 347 "hyprland-qtutils": {
350 "inputs": { 348 "inputs": {
351 "hyprutils": [ 349 "hyprutils": "hyprutils",
352 "hyprland",
353 "hyprutils"
354 ],
355 "nixpkgs": [ 350 "nixpkgs": [
356 "hyprland", 351 "hyprland",
357 "nixpkgs" 352 "nixpkgs"
@@ -437,7 +432,7 @@
437 "inputs": { 432 "inputs": {
438 "hyprgraphics": "hyprgraphics_2", 433 "hyprgraphics": "hyprgraphics_2",
439 "hyprlang": "hyprlang_2", 434 "hyprlang": "hyprlang_2",
440 "hyprutils": "hyprutils_2", 435 "hyprutils": "hyprutils_3",
441 "hyprwayland-scanner": "hyprwayland-scanner_2", 436 "hyprwayland-scanner": "hyprwayland-scanner_2",
442 "nixpkgs": [ 437 "nixpkgs": [
443 "nixpkgs" 438 "nixpkgs"
@@ -461,7 +456,7 @@
461 }, 456 },
462 "hyprpicker-git": { 457 "hyprpicker-git": {
463 "inputs": { 458 "inputs": {
464 "hyprutils": "hyprutils_3", 459 "hyprutils": "hyprutils_4",
465 "hyprwayland-scanner": "hyprwayland-scanner_3", 460 "hyprwayland-scanner": "hyprwayland-scanner_3",
466 "nixpkgs": [ 461 "nixpkgs": [
467 "nixpkgs" 462 "nixpkgs"
@@ -487,6 +482,33 @@
487 "inputs": { 482 "inputs": {
488 "nixpkgs": [ 483 "nixpkgs": [
489 "hyprland", 484 "hyprland",
485 "hyprland-qtutils",
486 "nixpkgs"
487 ],
488 "systems": [
489 "hyprland",
490 "hyprland-qtutils",
491 "systems"
492 ]
493 },
494 "locked": {
495 "lastModified": 1742984269,
496 "narHash": "sha256-uz9FaCIbga/gQ5ZG1Hb4HVVjTWT1qjjCAFlCXiaefxg=",
497 "owner": "hyprwm",
498 "repo": "hyprutils",
499 "rev": "7248194a2ce0106ae647b70d0526a96dc9d6ad60",
500 "type": "github"
501 },
502 "original": {
503 "owner": "hyprwm",
504 "repo": "hyprutils",
505 "type": "github"
506 }
507 },
508 "hyprutils_2": {
509 "inputs": {
510 "nixpkgs": [
511 "hyprland",
490 "nixpkgs" 512 "nixpkgs"
491 ], 513 ],
492 "systems": [ 514 "systems": [
@@ -508,7 +530,7 @@
508 "type": "github" 530 "type": "github"
509 } 531 }
510 }, 532 },
511 "hyprutils_2": { 533 "hyprutils_3": {
512 "inputs": { 534 "inputs": {
513 "nixpkgs": [ 535 "nixpkgs": [
514 "hyprlock", 536 "hyprlock",
@@ -533,7 +555,7 @@
533 "type": "github" 555 "type": "github"
534 } 556 }
535 }, 557 },
536 "hyprutils_3": { 558 "hyprutils_4": {
537 "inputs": { 559 "inputs": {
538 "nixpkgs": [ 560 "nixpkgs": [
539 "hyprpicker-git", 561 "hyprpicker-git",
@@ -717,17 +739,17 @@
717 }, 739 },
718 "nixpkgs": { 740 "nixpkgs": {
719 "locked": { 741 "locked": {
720 "lastModified": 1739736696, 742 "lastModified": 1742889210,
721 "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", 743 "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=",
722 "owner": "nixos", 744 "owner": "NixOS",
723 "repo": "nixpkgs", 745 "repo": "nixpkgs",
724 "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f", 746 "rev": "698214a32beb4f4c8e3942372c694f40848b360d",
725 "type": "github" 747 "type": "github"
726 }, 748 },
727 "original": { 749 "original": {
728 "owner": "nixos", 750 "owner": "NixOS",
751 "ref": "nixos-unstable",
729 "repo": "nixpkgs", 752 "repo": "nixpkgs",
730 "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f",
731 "type": "github" 753 "type": "github"
732 } 754 }
733 }, 755 },
@@ -746,6 +768,22 @@
746 "type": "github" 768 "type": "github"
747 } 769 }
748 }, 770 },
771 "nixpkgs_2": {
772 "locked": {
773 "lastModified": 1739736696,
774 "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=",
775 "owner": "nixos",
776 "repo": "nixpkgs",
777 "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f",
778 "type": "github"
779 },
780 "original": {
781 "owner": "nixos",
782 "repo": "nixpkgs",
783 "rev": "d74a2335ac9c133d6bbec9fc98d91a77f1604c1f",
784 "type": "github"
785 }
786 },
749 "pre-commit-hooks": { 787 "pre-commit-hooks": {
750 "inputs": { 788 "inputs": {
751 "flake-compat": "flake-compat", 789 "flake-compat": "flake-compat",
@@ -779,8 +817,9 @@
779 "hyprpicker-git": "hyprpicker-git", 817 "hyprpicker-git": "hyprpicker-git",
780 "mozff": "mozff", 818 "mozff": "mozff",
781 "nixgl": "nixgl", 819 "nixgl": "nixgl",
782 "nixpkgs": "nixpkgs", 820 "nixpkgs": "nixpkgs_2",
783 "wpaperd": "wpaperd" 821 "wpaperd": "wpaperd",
822 "zen-browser": "zen-browser"
784 } 823 }
785 }, 824 },
786 "rust-overlay": { 825 "rust-overlay": {
@@ -942,6 +981,27 @@
942 "repo": "xdg-desktop-portal-hyprland", 981 "repo": "xdg-desktop-portal-hyprland",
943 "type": "github" 982 "type": "github"
944 } 983 }
984 },
985 "zen-browser": {
986 "inputs": {
987 "nixpkgs": [
988 "nixpkgs"
989 ]
990 },
991 "locked": {
992 "lastModified": 1742871532,
993 "narHash": "sha256-ciC3zul202dnIwpAplSaCJTeXOUce7Pl1d+SMFwPQls=",
994 "owner": "0xc000022070",
995 "repo": "zen-browser-flake",
996 "rev": "bef72020b20475847f24cd27134dca06724d4ba7",
997 "type": "github"
998 },
999 "original": {
1000 "owner": "0xc000022070",
1001 "repo": "zen-browser-flake",
1002 "rev": "bef72020b20475847f24cd27134dca06724d4ba7",
1003 "type": "github"
1004 }
945 } 1005 }
946 }, 1006 },
947 "root": "root", 1007 "root": "root",
diff --git a/home-config/nix-home-manager/flake.nix b/home-config/nix-home-manager/flake.nix
index ba3d01a..38b0708 100644
--- a/home-config/nix-home-manager/flake.nix
+++ b/home-config/nix-home-manager/flake.nix
@@ -3,9 +3,9 @@
3 3
4 inputs = { 4 inputs = {
5 # Specify the source of Home Manager and Nixpkgs. 5 # Specify the source of Home Manager and Nixpkgs.
6 nixpkgs.url = "github:nixos/nixpkgs/d74a2335ac9c133d6bbec9fc98d91a77f1604c1f"; 6 nixpkgs.url = "github:nixos/nixpkgs/a84ebe20c6bc2ecbcfb000a50776219f48d134cc";
7 home-manager = { 7 home-manager = {
8 url = "github:nix-community/home-manager/53c587d263f94aaf6a281745923c76bbec62bcf3"; 8 url = "github:nix-community/home-manager/693840c01b9bef9e54100239cef937e53d4661bf";
9 inputs.nixpkgs.follows = "nixpkgs"; 9 inputs.nixpkgs.follows = "nixpkgs";
10 }; 10 };
11 hyprlock = { 11 hyprlock = {
@@ -17,7 +17,7 @@
17 inputs.nixpkgs.follows = "nixpkgs"; 17 inputs.nixpkgs.follows = "nixpkgs";
18 }; 18 };
19 hyprland = { 19 hyprland = {
20 url = "github:hyprwm/hyprland/v0.47.2"; 20 url = "github:hyprwm/hyprland/v0.48.0";
21 inputs.nixpkgs.follows = "nixpkgs"; 21 inputs.nixpkgs.follows = "nixpkgs";
22 #inputs.hyprutils.url = "github:/hyprwm/hyprutils/6a8bc9d2a4451df12f5179dc0b1d2d46518a90ab"; 22 #inputs.hyprutils.url = "github:/hyprwm/hyprutils/6a8bc9d2a4451df12f5179dc0b1d2d46518a90ab";
23 }; 23 };
@@ -42,9 +42,13 @@
42 inputs.hyprland.follows = "hyprland"; 42 inputs.hyprland.follows = "hyprland";
43 inputs.nixpkgs.follows = "hyprland/nixpkgs"; 43 inputs.nixpkgs.follows = "hyprland/nixpkgs";
44 }; 44 };
45 zen-browser = {
46 url = "github:0xc000022070/zen-browser-flake/bef72020b20475847f24cd27134dca06724d4ba7";
47 inputs.nixpkgs.follows = "nixpkgs";
48 };
45 }; 49 };
46 50
47 outputs = { nixpkgs, home-manager, hyprland, nixgl, wpaperd, hyprpicker-git, hyprlock, mozff, clipboard-sync, hypr-dynamic-cursors, ... }@inputs: 51 outputs = { nixpkgs, home-manager, hyprland, nixgl, wpaperd, hyprpicker-git, hyprlock, mozff, clipboard-sync, hypr-dynamic-cursors, zen-browser, ... }@inputs:
48 let 52 let
49 system = "x86_64-linux"; 53 system = "x86_64-linux";
50 pkgs = nixpkgs.legacyPackages.${system}; 54 pkgs = nixpkgs.legacyPackages.${system};
@@ -70,6 +74,7 @@
70 inherit mozff; 74 inherit mozff;
71 inherit clipboard-sync; 75 inherit clipboard-sync;
72 inherit hypr-dynamic-cursors; 76 inherit hypr-dynamic-cursors;
77 inherit zen-browser;
73 }; 78 };
74 } 79 }
75 ]; 80 ];
diff --git a/home-config/nix-home-manager/home.nix b/home-config/nix-home-manager/home.nix
index d2e0034..f5d386c 100644
--- a/home-config/nix-home-manager/home.nix
+++ b/home-config/nix-home-manager/home.nix
@@ -1,4 +1,24 @@
1{ config, pkgs, hyprland, nixgl, wpaperd, hyprpicker-git, hyprlock, mozff, clipboard-sync, hypr-dynamic-cursors, ... }: 1{ config, pkgs, hyprland, nixgl, wpaperd, hyprpicker-git, hyprlock, mozff, clipboard-sync, hypr-dynamic-cursors, zen-browser, ... }:
2let
3 # THIS IS NOT PERFECT AT ALL YET!!! Gets the basics done (my important
4 # policies regarding accounts and extensions. Does not set up profile
5 # stuff, like search. Most importantly, it DOES NOT add system CAs.
6 # To do that, run:
7 # `certutil -A -n "name" -t "CT,c" -i ./path/to/cert -d ~/.zen/profile-folder`
8 # I do this for my root and intermediate. BEWARE WHEN INSTALLING NEW
9 # SYSTEMS!!!!
10 ffPolicies = import ./zenPolicies.nix;
11 customZen = zen-browser.packages.${pkgs.system}.default.overrideAttrs (old: {
12 installPhase = old.installPhase + ''
13 rm -f $out/lib/zen-${old.version}/distribution/policies.json
14 rm -rf $out/lib
15 mkdir $out/opt/zen/distribution
16 ln -s ${pkgs.writeText "firefox-policies.json" (builtins.toJSON ffPolicies)} \
17 "$out/opt/zen/distribution/policies.json"
18 '';
19 });
20
21in
2 22
3{ 23{
4 imports = [ 24 imports = [
@@ -94,10 +114,14 @@
94 starship 114 starship
95 taskwarrior3 115 taskwarrior3
96 delta 116 delta
117 (flameshot.override { enableWlrSupport = true; })
97 118
98 # Here until i can fix firefox's stupid devtools issue 119 # Here until i can fix firefox's stupid devtools issue
99 chromium 120 chromium
100 121
122 # Maybe will work?
123 customZen
124
101 # Wrapped programs for some env variables 125 # Wrapped programs for some env variables
102 (pkgs.writeScriptBin "hyprlock" '' 126 (pkgs.writeScriptBin "hyprlock" ''
103 #! ${pkgs.bash}/bin/bash 127 #! ${pkgs.bash}/bin/bash
diff --git a/home-config/nix-home-manager/zenPolicies.nix b/home-config/nix-home-manager/zenPolicies.nix
new file mode 100644
index 0000000..55b1190
--- /dev/null
+++ b/home-config/nix-home-manager/zenPolicies.nix
@@ -0,0 +1,126 @@
1let
2 lock-false = {
3 Value = false;
4 Status = "locked";
5 };
6 lock-true = {
7 Value = true;
8 Status = "locked";
9 };
10in
11{
12
13policies = {
14 EnableTrackingProtection = {
15 Value = true;
16 Locked = true;
17 Cryptomining = true;
18 Fingerprinting = true;
19 EmailTracking = true;
20 };
21 UserMessaging = {
22 WhatsNew = false;
23 ExtensionRecommendations = false;
24 FeatureRecommendations = false;
25 UrlbarInterventions = false;
26 SkipOnboarding = true;
27 MoreFromMozilla = false;
28 Labs = false;
29 Locked = true;
30 };
31 DisableAppUpdate = true;
32 DisableAccounts = true;
33 DisableFirefoxAccounts = true;
34 DisableFirefoxStudies = true;
35 DisablePocket = true;
36 DisableTelemetry = true;
37 AutofillAddressEnabled = false;
38 AutofillCreditCardEnabled = false;
39 DisableMasterPasswordCreation = true;
40 PasswordManagerEnabled = false;
41 PrimaryPassword = false;
42 OfferToSaveLogins = false;
43 NoDefaultBookmarks = true;
44 OverrideFirstRunPage = "";
45 OverridePostUpdatePage = "";
46 FirefoxHome = {
47 Search = true;
48 TopSites = true;
49 SponsoredTopSites = false;
50 Highlights = false;
51 Pocket = false;
52 SponsoredPocket = false;
53 Snippets = false;
54 Locked = true;
55 };
56 SearchSuggestEnabled = true;
57 FirefoxSuggest = {
58 WebSuggestions = true;
59 SponsoredSuggestions = false;
60 ImproveSuggest = false;
61 Locked = true;
62 };
63 PictureInPicture = lock-true;
64 HardwareAcceleration = true;
65 Certificates = {
66 ImportEnterpriseRoots = true;
67 };
68 ExtensionSettings = {
69 #"*".installation_mode = "blocked";
70 # uBlock Origin
71 "uBlock0@raymondhill.net" = {
72 install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
73 installation_mode = "force_installed";
74 };
75 # Bitwarden
76 "{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
77 install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
78 installation_mode = "normal_installed";
79 };
80 # SponsorBlock
81 "sponsorBlocker@ajay.app" = {
82 install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
83 installation_mode = "force_installed";
84 };
85 # DeArrow
86 "deArrow@ajay.app" = {
87 install_url = "https://addons.mozilla.org/firefox/downloads/latest/dearrow/latest.xpi";
88 installation_mode = "force_installed";
89 };
90 # Return Youtube Dislike
91 "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = {
92 install_url = "https://addons.mozilla.org/firefox/downloads/latest/return-youtube-dislikes/latest.xpi";
93 installation_mode = "force_installed";
94 };
95 # Youtube Nonstop
96 "{0d7cafdd-501c-49ca-8ebb-e3341caaa55e}" = {
97 install_url = "https://addons.mozilla.org/firefox/downloads/latest/youtube-nonstop/latest.xpi";
98 installation_mode = "force_installed";
99 };
100 # TamperMonkey
101 "firefox@tampermonkey.net" = {
102 install_url = "https://addons.mozilla.org/firefox/downloads/latest/tampermonkey/latest.xpi";
103 installation_mode = "force_installed";
104 };
105 # Floccus
106 "floccus@handmadeideas.org" = {
107 install_url = "https://addons.mozilla.org/firefox/downloads/latest/floccus/latest.xpi";
108 installation_mode = "force_installed";
109 };
110 # Mailvelope
111 "jid1-AQqSMBYb0a8ADg@jetpack" = {
112 install_url = "https://addons.mozilla.org/firefox/downloads/latest/mailvelope/latest.xpi";
113 installation_mode = "force_installed";
114 };
115 };
116 Preferences = {
117 "xpinstall.whitelist.required" = lock-true;
118 "dom.webgpu.enabled" = lock-true;
119 "media.eme.enabled" = lock-true;
120 "general.autoScroll" = lock-true;
121 "general.smoothScroll" = lock-true;
122 "browser.crashReports.unsubmittedCheck.autoSubmit2" = lock-false;
123 "browser.aboutConfig.showWarning" = lock-false;
124 };
125};
126}
diff --git a/modules/ryan-packages/package-management.scm b/modules/ryan-packages/package-management.scm
new file mode 100644
index 0000000..9629168
--- /dev/null
+++ b/modules/ryan-packages/package-management.scm
@@ -0,0 +1,233 @@
1(define-module (ryan-packages package-management)
2 #:use-module ((guix licenses) #:prefix license:)
3 #:use-module (guix build-system meson)
4 #:use-module (guix build-system cmake)
5 #:use-module (guix packages)
6 #:use-module (guix git-download)
7 #:use-module (guix gexp)
8 #:use-module (gnu packages)
9 #:use-module (gnu packages autotools)
10 #:use-module (gnu packages backup)
11 #:use-module (gnu packages bdw-gc)
12 #:use-module (gnu packages bison)
13 #:use-module (gnu packages boost)
14 #:use-module (gnu packages compression)
15 #:use-module (gnu packages check)
16 #:use-module (gnu packages cmake)
17 #:use-module (gnu packages cpp)
18 #:use-module (gnu packages crypto)
19 #:use-module (gnu packages curl)
20 #:use-module (gnu packages databases)
21 #:use-module (gnu packages flex)
22 #:use-module (gnu packages gcc)
23 #:use-module (gnu packages libedit)
24 #:use-module (gnu packages linux)
25 #:use-module (gnu packages llvm)
26 #:use-module (gnu packages markup)
27 #:use-module (gnu packages package-management)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages sqlite)
31 #:use-module (gnu packages tls)
32 #:use-module (gnu packages version-control)
33 #:use-module (gnu packages web)
34 #:use-module (guix utils))
35
36(define-public nix-ryan
37 (package
38 (name "nix")
39 (version "2.26.3")
40 (source
41 (origin
42 (method git-fetch)
43 (uri (git-reference
44 (url "https://github.com/NixOS/nix")
45 (commit version)))
46 (file-name (git-file-name "nix" version))
47 (sha256
48 (base32 "1rh9k0cdixahqzziylgg7p8j9p58h55m08h3l1kg369wlmi7r5g5"))))
49 (build-system meson-build-system)
50 (arguments
51 (list
52 #:configure-flags #~(list "--sysconfdir=/etc")
53 #:tests? #f))
54 (native-inputs
55 (list autoconf
56 autoconf-archive
57 automake
58 bison
59 gcc-14
60 cmake
61 flex
62 perl
63 perl-dbi
64 perl-dbd-sqlite
65 googletest
66 jq
67 libtool
68 pkg-config
69 rapidcheck))
70 (inputs
71 (list boost-ryan
72 brotli
73 bzip2
74 curl
75 editline
76 libarchive
77 libgc-ryan
78 libseccomp-ryan
79 libsodium
80 libbl3
81 libgit2-1.9
82 lowdown
83 nlohmann-json
84 openssl
85 sqlite
86 toml11
87 xz
88 zlib))
89 (home-page "https://nixos.org/")
90 (synopsis "The Nix package manager")
91 (description "todo")
92 (license license:lgpl2.1+)))
93
94(define libbl3
95 (package
96 (name "blake3")
97 (version "1.7.0")
98 (source
99 (origin
100 (method git-fetch)
101 (uri (git-reference
102 (url "https://github.com/BLAKE3-team/BLAKE3")
103 (commit version)))
104 (file-name (git-file-name name version))
105 (sha256
106 (base32 "1dsx5jmr8csgzdvfxf4byc1086rg6vclqgqkz54la8rpfn3gkh6k"))))
107 (build-system cmake-build-system)
108 (arguments
109 (list
110 #:configure-flags #~(list "-DCMAKE_POSITION_INDEPENDENT_CODE=on")
111 #:phases
112 #~(modify-phases %standard-phases
113 (add-after 'unpack 'enter-build-directory
114 (lambda _ (chdir "c") #t))
115 (add-before 'build 'set-env
116 (lambda _
117 (setenv "CFLAGS" "-fPIC")
118 (setenv "CXXFLAGS" "-fPIC")
119 #t)))))
120 (home-page "https://github.com/BLAKE3-team/BLAKE3")
121 (synopsis "Official C implementation of BLAKE3")
122 (description "todo")
123 (license license:expat)))
124
125(define toml11
126 (package
127 (name "toml11")
128 (version "v4.4.0")
129 (source
130 (origin
131 (method git-fetch)
132 (uri (git-reference
133 (url "https://github.com/ToruNiina/toml11")
134 (commit version)))
135 (sha256
136 (base32 "0d15b50cf9jgvh3w99xh6crh03bn2dmv9bdyvzq6knsk2diql1dj"))))
137 (build-system cmake-build-system)
138 (home-page "https://github.com/ToruNiina/toml11")
139 (synopsis "TODO")
140 (description "TODO")
141 (license license:expat)))
142
143(define libgit2-1.9
144 (package
145 (inherit libgit2-1.8)
146 (version "1.9.0")
147 (source (origin
148 (inherit (package-source libgit2-1.8))
149 (uri (git-reference
150 (url "https://github.com/libgit2/libgit2")
151 (commit (string-append "v" version))))
152 (file-name (git-file-name "libgit2" version))
153 (sha256
154 (base32
155 "06ajn5i5l1209z7x7jxcpw68ph0a6g3q67bmx0jm381rr8cb4zdz"))
156 (snippet
157 #~(begin
158 (for-each delete-file-recursively
159 '("deps/llhttp"
160 "deps/ntlmclient"
161 "deps/pcre"
162 "deps/winhttp"
163 "deps/zlib"))))))))
164
165(define libgc-ryan
166 (package
167 (inherit libgc)
168 (version "8.2.8")
169 (source (origin
170 (method git-fetch)
171 (uri (git-reference
172 (url "https://github.com/ivmai/bdwgc")
173 (commit (string-append "v" version))))
174 (file-name (git-file-name "libgc" version))
175 (sha256
176 (base32 "1xzvr5wb36flkbjqjyk5ilhda1a3yk61rgprxfjzdf1rzlmqn12i"))))
177 (native-inputs (modify-inputs (package-native-inputs libgc) (prepend autoconf autoconf-archive automake libtool)))))
178
179(define boost-ryan
180 (package
181 (inherit boost)
182 (version "1.87.0")
183 (source (origin
184 (method git-fetch)
185 (uri (git-reference
186 (url "https://github.com/boostorg/boost")
187 (commit (string-append "boost-" version))
188 (recursive? #t)))
189 (file-name (git-file-name "boost" version))
190 (sha256
191 (base32 "1xirczrh2rgk2x70crw33w6566d2by9q675wlyv0zj69f49z8prn"))))
192 (native-inputs (modify-inputs (package-native-inputs boost) (prepend clang-18)))
193 (arguments
194 (append
195 (substitute-keyword-arguments (package-arguments boost))
196 (list
197 #:tests? #f
198 #:configure-flags
199 #~(let ((icu (dirname (dirname (search-input-file
200 %build-inputs "bin/uconv")))))
201 (list
202 ;; Auto-detection looks for ICU only in traditional
203 ;; install locations.
204 (string-append "--with-icu=" icu)
205 ;; Ditto for Python.
206 #$@(if (%current-target-system)
207 #~()
208 #~((let ((python (dirname (dirname (search-input-file
209 %build-inputs
210 "bin/python")))))
211 (string-append "--with-python-root=" python)
212 (string-append "--with-python=" python
213 "/bin/python")
214 (string-append "--with-python-version="
215 (python-version python)))))
216 "--with-toolset=clang")))))))
217
218(define libseccomp-ryan
219 (package
220 (inherit libseccomp)
221 (version "2.6.0")
222 (source (origin
223 (method git-fetch)
224 (uri (git-reference
225 (url "https://github.com/seccomp/libseccomp")
226 (commit (string-append "v" version))))
227 (file-name (git-file-name "libseccomp" version))
228 (sha256
229 (base32 "189yh66aj3z3jvns739qbj504f3mcl3w44pxxizw877pbj3kal11"))))
230 (native-inputs (modify-inputs (package-native-inputs libseccomp) (prepend autoconf autoconf-archive automake libtool)))))
231
232
233nix-ryan
diff --git a/modules/ryan-services/nix.scm b/modules/ryan-services/nix.scm
new file mode 100644
index 0000000..75c9082
--- /dev/null
+++ b/modules/ryan-services/nix.scm
@@ -0,0 +1,182 @@
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019, 2020, 2021, 2024 Oleg Pykhalov <go.wigust@gmail.com>
3;;; Copyright © 2020 Peng Mei Yu <i@pengmeiyu.com>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (ryan-services nix)
21 #:use-module (gnu packages admin)
22 #:use-module (gnu packages bash)
23 #:use-module (gnu packages package-management)
24 #:use-module (gnu services base)
25 #:use-module (gnu services configuration)
26 #:use-module (gnu services shepherd)
27 #:use-module (gnu services web)
28 #:use-module (gnu services)
29 #:use-module (gnu system file-systems)
30 #:use-module (gnu system shadow)
31 #:use-module (guix gexp)
32 #:use-module (guix packages)
33 #:use-module (guix records)
34 #:use-module (guix store)
35 #:use-module (srfi srfi-1)
36 #:use-module (srfi srfi-26)
37 #:use-module (ice-9 match)
38 #:use-module (ice-9 format)
39 #:use-module (guix modules)
40 #:export (nix-service-type
41
42 nix-configuration
43 nix-configuration?))
44
45;;; Commentary:
46;;;
47;;; This module provides a service definition for the Nix daemon.
48;;;
49;;; Code:
50
51(define-record-type* <nix-configuration>
52 nix-configuration make-nix-configuration
53 nix-configuration?
54 (package nix-configuration-package ;file-like
55 (default nix))
56 (sandbox nix-configuration-sandbox ;boolean
57 (default #t))
58 (build-directory nix-configuration-build-directory ;string
59 (default "/tmp"))
60 (build-sandbox-items nix-configuration-build-sandbox-items ;list of strings
61 (default '()))
62 (extra-config nix-configuration-extra-config ;list of strings
63 (default '()))
64 (extra-options nix-configuration-extra-options ;list of strings
65 (default '())))
66
67;; Copied from gnu/services/base.scm
68(define* (nix-build-accounts count #:key
69 (group "nixbld")
70 (shadow shadow))
71 "Return a list of COUNT user accounts for Nix build users with the given
72GID."
73 (unfold (cut > <> count)
74 (lambda (n)
75 (user-account
76 (name (format #f "nixbld~2,'0d" n))
77 (system? #t)
78 (group group)
79 (supplementary-groups (list group "kvm"))
80 (comment (format #f "Nix Build User ~2d" n))
81 (home-directory "/var/empty")
82 (shell (file-append shadow "/sbin/nologin"))))
83 1+
84 1))
85(define (nix-accounts _)
86 "Return the user accounts and user groups."
87 (cons (user-group
88 (name "nixbld")
89 (system? #t)
90
91 ;; Use a fixed GID so that we can create the store with the right
92 ;; owner.
93 (id 40000))
94 (nix-build-accounts 10 #:group "nixbld")))
95
96(define (nix-activation _)
97 ;; Return the activation gexp.
98 #~(begin
99 (use-modules (guix build utils)
100 (srfi srfi-26))
101 (for-each (cut mkdir-p <>) '("/nix/var/log"
102 "/nix/var/nix/gcroots/per-user"
103 "/nix/var/nix/profiles/per-user"))
104 (unless (file-exists? #$%nix-store-directory)
105 (mkdir-p #$%nix-store-directory)
106 (chown #$%nix-store-directory
107 (passwd:uid (getpw "root")) (group:gid (getpw "nixbld01")))
108 (chmod #$%nix-store-directory #o775))
109 (for-each (cut chmod <> #o777) '("/nix/var/nix/profiles"
110 "/nix/var/nix/profiles/per-user"))))
111
112(define nix-service-etc
113 (match-lambda
114 (($ <nix-configuration> package sandbox build-directory build-sandbox-items extra-config)
115 (let ((ref-file (references-file package)))
116 `(("nix/nix.conf"
117 ,(computed-file
118 "nix.conf"
119 #~(begin
120 (use-modules (srfi srfi-26)
121 (ice-9 format))
122 (with-output-to-file #$output
123 (lambda _
124 (define internal-sandbox-paths
125 (call-with-input-file #$ref-file read))
126
127 (format #t "sandbox = ~a~%" (if #$sandbox "true" "false"))
128 ;; config.nix captures store file names.
129 (format #t "sandbox-paths = ~{~a ~}~%"
130 (append (list (string-append "/bin/sh=" #$bash-minimal "/bin/bash"))
131 internal-sandbox-paths
132 '#$build-sandbox-items))
133 (for-each (cut display <>) '#$extra-config)))))))))))
134
135(define %nix-store-directory
136 "/nix/store")
137
138(define %immutable-nix-store
139 ;; Read-only store to avoid users or daemons accidentally modifying it.
140 ;; 'nix-daemon' has provisions to remount it read-write in its own name
141 ;; space.
142 (list (file-system
143 (device %nix-store-directory)
144 (mount-point %nix-store-directory)
145 (type "none")
146 (check? #f)
147 (flags '(read-only bind-mount)))))
148
149(define nix-shepherd-service
150 ;; Return a <shepherd-service> for Nix.
151 (match-lambda
152 (($ <nix-configuration> package _ build-directory _ _ extra-options)
153 (list
154 (shepherd-service
155 (provision '(nix-daemon))
156 (documentation "Run nix-daemon.")
157 (requirement '(user-processes file-system-/nix/store))
158 (start #~(make-forkexec-constructor
159 (list (string-append #$package "/bin/nix-daemon")
160 #$@extra-options)
161 #:environment-variables
162 (list (string-append "TMPDIR=" #$build-directory)
163 "PATH=/run/current-system/profile/bin")))
164 (respawn? #f)
165 (stop #~(make-kill-destructor)))))))
166
167(define nix-service-type
168 (service-type
169 (name 'nix)
170 (extensions
171 (list (service-extension shepherd-root-service-type nix-shepherd-service)
172 (service-extension account-service-type nix-accounts)
173 (service-extension activation-service-type nix-activation)
174 (service-extension etc-service-type nix-service-etc)
175 (service-extension profile-service-type
176 (compose list nix-configuration-package))
177 (service-extension file-system-service-type
178 (const %immutable-nix-store))))
179 (description "Run the Nix daemon.")
180 (default-value (nix-configuration))))
181
182;;; nix.scm ends here