diff --git a/flake.lock b/flake.lock index dad55a08..1f7bb189 100644 --- a/flake.lock +++ b/flake.lock @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1770654520, - "narHash": "sha256-mg5WZMIPGsFu9MxSrUcuJUPMbfMsF77el5yb/7rc10k=", + "lastModified": 1771505064, + "narHash": "sha256-lh9rF+C/nKFyWAqbHIa6tK9L/6N0UaQg7zw15aP4jBM=", "owner": "nix-community", "repo": "home-manager", - "rev": "6c4fdbe1ad198fac36c320fd45c5957324a80b8e", + "rev": "a0a01d8811fd5e99e003078ed64a0e7b531545dd", "type": "github" }, "original": { @@ -175,11 +175,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1770562336, - "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", + "lastModified": 1771369470, + "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d6c71932130818840fc8fe9509cf50be8c64634f", + "rev": "0182a361324364ae3f436a63005877674cf45efb", "type": "github" }, "original": { @@ -199,11 +199,11 @@ ] }, "locked": { - "lastModified": 1770732881, - "narHash": "sha256-yGkibRit67Pz1uo1Kk55kZBHQq90K3gc0N762JGW/uQ=", + "lastModified": 1771506707, + "narHash": "sha256-R9oBi0EPsWN4bHfYgcyiSzx31/Fkgg3IHubf30II7Ow=", "owner": "nix-community", "repo": "NUR", - "rev": "06490c1287ab62a8c5075c440fd3e247913bc29c", + "rev": "30ad144e51a0ae8b47aa84c1139e84fc278d6e86", "type": "github" }, "original": { diff --git a/flake/checks.nix b/flake/checks.nix index 73e64d52..01d3c7a5 100644 --- a/flake/checks.nix +++ b/flake/checks.nix @@ -15,6 +15,10 @@ enable = true; }; + nixf-diagnose = { + enable = true; + }; + nixpkgs-fmt = { enable = true; }; diff --git a/hosts/homes/ambroisie@bazin/default.nix b/hosts/homes/ambroisie@bazin/default.nix index 365b70df..9ef26427 100644 --- a/hosts/homes/ambroisie@bazin/default.nix +++ b/hosts/homes/ambroisie@bazin/default.nix @@ -22,6 +22,10 @@ package = pkgs.emptyDirectory; }; + jujutsu = { + package = pkgs.emptyDirectory; + }; + tmux = { # I use scripts that use the passthrough sequence often on this host enablePassthrough = true; diff --git a/hosts/homes/ambroisie@mousqueton/default.nix b/hosts/homes/ambroisie@mousqueton/default.nix index 13836189..1ffee2b0 100644 --- a/hosts/homes/ambroisie@mousqueton/default.nix +++ b/hosts/homes/ambroisie@mousqueton/default.nix @@ -25,6 +25,10 @@ package = pkgs.emptyDirectory; }; + jujutsu = { + package = pkgs.emptyDirectory; + }; + tmux = { # I use scripts that use the passthrough sequence often on this host enablePassthrough = true; diff --git a/hosts/nixos/porthos/secrets/servarr/cross-seed/configuration.json.age b/hosts/nixos/porthos/secrets/servarr/cross-seed/configuration.json.age index 94fdf975..b8cbe6aa 100644 Binary files a/hosts/nixos/porthos/secrets/servarr/cross-seed/configuration.json.age and b/hosts/nixos/porthos/secrets/servarr/cross-seed/configuration.json.age differ diff --git a/modules/home/calibre/default.nix b/modules/home/calibre/default.nix index de7c1263..e3733b10 100644 --- a/modules/home/calibre/default.nix +++ b/modules/home/calibre/default.nix @@ -10,8 +10,10 @@ in }; config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - cfg.package - ]; + programs.calibre = { + enable = true; + + inherit (cfg) package; + }; }; } diff --git a/modules/home/default.nix b/modules/home/default.nix index ad3b9791..eb3d0f29 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -24,6 +24,7 @@ ./gtk ./htop ./jq + ./jujutsu ./keyboard ./mail ./mpv diff --git a/modules/home/delta/default.nix b/modules/home/delta/default.nix index e76edc60..f6526321 100644 --- a/modules/home/delta/default.nix +++ b/modules/home/delta/default.nix @@ -11,6 +11,10 @@ in git = { enable = my.mkDisableOption "git integration"; }; + + jujutsu = { + enable = my.mkDisableOption "jujutsu integration"; + }; }; config = lib.mkIf cfg.enable { @@ -20,6 +24,9 @@ in inherit (cfg) package; enableGitIntegration = cfg.git.enable; + # `jj log -p` does not use `delta` + # https://github.com/jj-vcs/jj/issues/4142 + enableJujutsuIntegration = cfg.jujutsu.enable; options = { features = "diff-highlight decorations"; diff --git a/modules/home/gdb/default.nix b/modules/home/gdb/default.nix index 1ffc6bd9..b7c3aca5 100644 --- a/modules/home/gdb/default.nix +++ b/modules/home/gdb/default.nix @@ -17,7 +17,7 @@ in config = lib.mkIf cfg.enable (lib.mkMerge [ { - home.packages = with pkgs; [ + home.packages = [ cfg.package ]; diff --git a/modules/home/jujutsu/default.nix b/modules/home/jujutsu/default.nix new file mode 100644 index 00000000..3072af42 --- /dev/null +++ b/modules/home/jujutsu/default.nix @@ -0,0 +1,141 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.my.home.jujutsu; + + inherit (lib.my) mkMailAddress; +in +{ + options.my.home.jujutsu = with lib; { + enable = my.mkDisableOption "jujutsu configuration"; + + package = mkPackageOption pkgs "jujutsu" { }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + # For `jj git` commands + assertion = cfg.enable -> config.my.home.git.enable; + message = '' + `config.my.home.jujutsu` relies on `config.my.home.git` being enabled. + ''; + } + ]; + + programs.jujutsu = { + enable = true; + + inherit (cfg) package; + + settings = { + # Who am I? + user = { + name = "Bruno BELANYI"; + email = mkMailAddress "bruno" "belanyi.fr"; + }; + + aliases = { + jj = [ ]; + # FIXME: + # * still not a big fan of the template + lol = [ "log" "-r" "..@" "-T" "builtin_log_oneline" ]; + lola = [ "lol" "-r" "all()" ]; + # FIXME: equivalent to `git switch -` + # See https://github.com/jj-vcs/jj/issues/2871 + # Might be broken recently https://discord.com/channels/968932220549103686/1380272574709366989/1380432041983606855 + # TODO: + # * `pick` (https://github.com/jj-vcs/jj/issues/5446): [ "util" "exec" "--" "bash" "-c" "jj log -p -r \"diff_contains($1)\"" "" ] + # * `root`: `jj workspace root` (barely necessary then) + }; + + ui = { + # Stop nagging me about it, though I am not a fan of its UI. + diff-editor = ":builtin"; + # I don't like word-diff + diff-formatter = ":git"; + # Stop nagging me about it, though I am not a fan of its UI. + merge-editor = ":builtin"; + # Does not honor `$PAGER` (anymore) + pager = lib.mkDefault config.home.sessionVariables.PAGER; + }; + + # FIXME: git equivalents + # I'd like a better formatted blame (more like delta's?) + # blame = { + # coloring = "repeatedLines"; + # markIgnoredLines = true; + # markUnblamables = true; + # }; + # FIXME: log colors should probably match git + # FIXME: patience diff? + # FIXME: fetch prune/pruneTags? + # FIXME: pull.rebase=true? Probably true TBH + # FIXME: push.default=simple? Probably true TBH + # FIXME: conflict style? ui.conflict-marker-style=git is diff3, not zdiff3. Default looks fine-ish + + # FIXME: from ma_9's config, plus my own stuff + # snapshot = { + # auto-track = "none()"; + # }; + # + # ui = { + # movement = { + # edit = false; + # }; + # }; + + templates = { + # Equivalent to `commit.verbose = true` in Git + draft_commit_description = "commit_description_verbose(self)"; + }; + + template-aliases = { + "commit_description_verbose(commit)" = '' + concat( + commit_description(commit), + "JJ: ignore-rest\n", + diff.git(), + ) + ''; + # FIXME: use `diff.summary()` instead? Supported by syntax highlighting + # See https://github.com/jj-vcs/jj/issues/1946#issuecomment-2572986485 + # FIXME: tree-sitter grammar isn't in `nvim-treesitter` (https://github.com/kareigu/tree-sitter-jjdescription) + "commit_description(commit)" = '' + concat( + commit.description(), "\n", + "JJ: This commit contains the following changes:\n", + indent("JJ: ", diff.stat(72)), + ) + ''; + }; + + "--scope" = [ + # Multiple identities + { + "--when" = { + repositories = [ "~/git/EPITA/" ]; + }; + user = { + name = "Bruno BELANYI"; + email = mkMailAddress "bruno.belanyi" "epita.fr"; + }; + } + { + "--when" = { + repositories = [ "~/git/work/" ]; + }; + user = { + name = "Bruno BELANYI"; + email = mkMailAddress "ambroisie" "google.com"; + }; + } + ]; + }; + }; + + # To drop in a `local.toml` configuration, not-versioned + xdg.configFile = { + "jj/conf.d/.keep".text = ""; + }; + }; +} diff --git a/modules/home/mail/accounts/default.nix b/modules/home/mail/accounts/default.nix index 5216ad5e..ca5e6ea6 100644 --- a/modules/home/mail/accounts/default.nix +++ b/modules/home/mail/accounts/default.nix @@ -11,7 +11,7 @@ let lib.mkDefault [ (lib.getExe pkgs.ambroisie.rbw-pass) "Mail" passName ]; address = mkMailAddress address domain; - aliases = builtins.map (lib.flip mkMailAddress domain) aliases; + aliases = map (lib.flip mkMailAddress domain) aliases; inherit primary; diff --git a/modules/home/trgui/default.nix b/modules/home/trgui/default.nix index ee545a98..63df3550 100644 --- a/modules/home/trgui/default.nix +++ b/modules/home/trgui/default.nix @@ -10,7 +10,7 @@ in }; config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ + home.packages = [ cfg.package ]; }; diff --git a/modules/home/vim/after/plugin/mappings/unimpaired.lua b/modules/home/vim/after/plugin/mappings/unimpaired.lua index 765b6b11..f83a3a34 100644 --- a/modules/home/vim/after/plugin/mappings/unimpaired.lua +++ b/modules/home/vim/after/plugin/mappings/unimpaired.lua @@ -82,7 +82,7 @@ local keys = { -- Disable option { "]o", group = "Disable option" }, - { "]ob", desc = "Light background" }, + { "]ob", desc = "Dark background" }, { "]oc", desc = "Cursor line" }, { "]od", desc = "Diff" }, { "]of", "FormatDisable", desc = "LSP Formatting" }, @@ -101,7 +101,7 @@ local keys = { -- Toggle option { "yo", group = "Toggle option" }, - { "yob", desc = "Light background" }, + { "yob", desc = "Toggle background" }, { "yoc", desc = "Cursor line" }, { "yod", desc = "Diff" }, { "yof", "FormatToggle", desc = "LSP Formatting" }, diff --git a/modules/home/vim/init.vim b/modules/home/vim/init.vim index 11429250..f3b50227 100644 --- a/modules/home/vim/init.vim +++ b/modules/home/vim/init.vim @@ -112,7 +112,7 @@ colorscheme gruvbox """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable search high-lighting while the search is on-going set hlsearch -" Ignore case on search +" Ignore case on search unless \C is in search terms set ignorecase " Ignore case unless there is an uppercase letter in the pattern set smartcase diff --git a/modules/home/vim/plugin/numbertoggle.lua b/modules/home/vim/plugin/numbertoggle.lua index b1e3df21..2299a629 100644 --- a/modules/home/vim/plugin/numbertoggle.lua +++ b/modules/home/vim/plugin/numbertoggle.lua @@ -1,7 +1,7 @@ -- Show lines numbers vim.opt.number = true -local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", { clear = true }) +local numbertoggle = vim.api.nvim_create_augroup("ambroisie.numbertoggle", { clear = true }) -- Toggle numbers between relative and absolute when changing buffers vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { diff --git a/modules/home/vim/plugin/settings/tree-sitter.lua b/modules/home/vim/plugin/settings/tree-sitter.lua index 2958c2a9..b533452b 100644 --- a/modules/home/vim/plugin/settings/tree-sitter.lua +++ b/modules/home/vim/plugin/settings/tree-sitter.lua @@ -83,7 +83,7 @@ end vim.api.nvim_create_autocmd("FileType", { pattern = "*", - group = vim.api.nvim_create_augroup("treesitter_attach", { clear = true }), + group = vim.api.nvim_create_augroup("ambroisie.treesitter_attach", { clear = true }), callback = function(args) local buf, filetype = args.buf, args.match local language = vim.treesitter.language.get_lang(filetype) diff --git a/modules/home/vim/plugin/signtoggle.lua b/modules/home/vim/plugin/signtoggle.lua index 3deca340..66e0ab4c 100644 --- a/modules/home/vim/plugin/signtoggle.lua +++ b/modules/home/vim/plugin/signtoggle.lua @@ -1,4 +1,4 @@ -local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true }) +local signtoggle = vim.api.nvim_create_augroup("ambroisie.signtoggle", { clear = true }) -- Only show sign column for the currently focused buffer, if it has a number column vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, { diff --git a/modules/home/wm/i3bar/default.nix b/modules/home/wm/i3bar/default.nix index 5ae0e7d7..28c19355 100644 --- a/modules/home/wm/i3bar/default.nix +++ b/modules/home/wm/i3bar/default.nix @@ -69,7 +69,7 @@ in inactive_state = "Idle"; }; in - builtins.map (block: defaults // block) cfg.vpn.blockConfigs + map (block: defaults // block) cfg.vpn.blockConfigs ) ) { diff --git a/modules/nixos/programs/steam/default.nix b/modules/nixos/programs/steam/default.nix index 0c7f9dad..c859bdb2 100644 --- a/modules/nixos/programs/steam/default.nix +++ b/modules/nixos/programs/steam/default.nix @@ -23,7 +23,7 @@ in enable = true; }; - environment.systemPackages = builtins.map lib.hiPrio [ + environment.systemPackages = map lib.hiPrio [ # Respect XDG conventions, leave my HOME alone (pkgs.writeShellScriptBin "steam" '' mkdir -p "${cfg.dataDir}" diff --git a/modules/nixos/services/backup/default.nix b/modules/nixos/services/backup/default.nix index 8aeeae19..79884063 100644 --- a/modules/nixos/services/backup/default.nix +++ b/modules/nixos/services/backup/default.nix @@ -96,7 +96,7 @@ in # Contains the UID/GID map, and other useful state "/var/lib/nixos" # SSH host keys (and public keys for convenience) - (builtins.map (key: [ key.path "${key.path}.pub" ]) config.services.openssh.hostKeys) + (map (key: [ key.path "${key.path}.pub" ]) config.services.openssh.hostKeys) ]; services.restic.backups.backblaze = { diff --git a/modules/nixos/services/nginx/default.nix b/modules/nixos/services/nginx/default.nix index ff530b0a..153a299f 100644 --- a/modules/nixos/services/nginx/default.nix +++ b/modules/nixos/services/nginx/default.nix @@ -188,14 +188,14 @@ in ++ (lib.flip lib.mapAttrsToList cfg.virtualHosts (_: { subdomain, ... } @ args: let conflicts = [ "port" "root" "socket" "redirect" ]; - optionsNotNull = builtins.map (v: args.${v} != null) conflicts; + optionsNotNull = map (v: args.${v} != null) conflicts; optionsSet = lib.filter lib.id optionsNotNull; in { assertion = builtins.length optionsSet == 1; message = '' Subdomain '${subdomain}' must have exactly one of ${ - lib.concatStringsSep ", " (builtins.map (v: "'${v}'") conflicts) + lib.concatStringsSep ", " (map (v: "'${v}'") conflicts) } configured. ''; })) @@ -208,7 +208,7 @@ in assertion = args.websocketsLocations != [ ] -> proxyPassUsed; message = '' Subdomain '${subdomain}' can only use 'websocketsLocations' with one of ${ - lib.concatStringsSep ", " (builtins.map (v: "'${v}'") proxyPass) + lib.concatStringsSep ", " (map (v: "'${v}'") proxyPass) }. ''; })) diff --git a/modules/nixos/services/sabnzbd/default.nix b/modules/nixos/services/sabnzbd/default.nix index 9e0d9c3c..37ba96cf 100644 --- a/modules/nixos/services/sabnzbd/default.nix +++ b/modules/nixos/services/sabnzbd/default.nix @@ -2,17 +2,35 @@ { config, lib, ... }: let cfg = config.my.services.sabnzbd; - port = 9090; # NOTE: not declaratively set... in { options.my.services.sabnzbd = with lib; { enable = mkEnableOption "SABnzbd binary news reader"; + + port = mkOption { + type = types.port; + default = 9090; + example = 4242; + description = "The port on which SABnzbd will listen for incoming HTTP traffic"; + }; }; config = lib.mkIf cfg.enable { services.sabnzbd = { enable = true; group = "media"; + + # Don't warn about the config file + configFile = null; + # I want to configure servers outside of Nix + allowConfigWrite = true; + + settings = { + misc = { + host = "127.0.0.1"; + inherit (cfg) port; + }; + }; }; # Set-up media group @@ -20,7 +38,7 @@ in my.services.nginx.virtualHosts = { sabnzbd = { - inherit port; + inherit (cfg) port; }; }; diff --git a/modules/nixos/services/servarr/bazarr.nix b/modules/nixos/services/servarr/bazarr.nix index 637da0c7..67d34169 100644 --- a/modules/nixos/services/servarr/bazarr.nix +++ b/modules/nixos/services/servarr/bazarr.nix @@ -4,7 +4,7 @@ let in { options.my.services.servarr.bazarr = with lib; { - enable = lib.mkEnableOption "Bazarr" // { + enable = mkEnableOption "Bazarr" // { default = config.my.services.servarr.enableAll; }; diff --git a/modules/nixos/services/servarr/jackett.nix b/modules/nixos/services/servarr/jackett.nix index 481cd3de..8e8a5c3e 100644 --- a/modules/nixos/services/servarr/jackett.nix +++ b/modules/nixos/services/servarr/jackett.nix @@ -4,7 +4,7 @@ let in { options.my.services.servarr.jackett = with lib; { - enable = lib.mkEnableOption "Jackett" // { + enable = mkEnableOption "Jackett" // { default = config.my.services.servarr.enableAll; }; diff --git a/modules/nixos/services/servarr/nzbhydra.nix b/modules/nixos/services/servarr/nzbhydra.nix index 7b639869..f2f82ac2 100644 --- a/modules/nixos/services/servarr/nzbhydra.nix +++ b/modules/nixos/services/servarr/nzbhydra.nix @@ -4,7 +4,7 @@ let in { options.my.services.servarr.nzbhydra = with lib; { - enable = lib.mkEnableOption "NZBHydra2" // { + enable = mkEnableOption "NZBHydra2" // { default = config.my.services.servarr.enableAll; }; }; diff --git a/modules/nixos/services/servarr/prowlarr.nix b/modules/nixos/services/servarr/prowlarr.nix index ce044c63..6825843c 100644 --- a/modules/nixos/services/servarr/prowlarr.nix +++ b/modules/nixos/services/servarr/prowlarr.nix @@ -5,7 +5,7 @@ let in { options.my.services.servarr.prowlarr = with lib; { - enable = lib.mkEnableOption "Prowlarr" // { + enable = mkEnableOption "Prowlarr" // { default = config.my.services.servarr.enableAll; }; diff --git a/modules/nixos/services/servarr/starr.nix b/modules/nixos/services/servarr/starr.nix index 2bf7c114..0ccdaa42 100644 --- a/modules/nixos/services/servarr/starr.nix +++ b/modules/nixos/services/servarr/starr.nix @@ -12,7 +12,7 @@ let in { options.my.services.servarr.${starr} = with lib; { - enable = lib.mkEnableOption (lib.toSentenceCase starr) // { + enable = mkEnableOption (lib.toSentenceCase starr) // { default = config.my.services.servarr.enableAll; }; diff --git a/overlays/default.nix b/overlays/default.nix index 683e021b..d3e30aa8 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,6 @@ # Automatically import all overlays in the directory let files = builtins.readDir ./.; - overlays = builtins.removeAttrs files [ "default.nix" ]; + overlays = removeAttrs files [ "default.nix" ]; in builtins.mapAttrs (name: _: import "${./.}/${name}") overlays diff --git a/overlays/downgrade-transmission/default.nix b/overlays/downgrade-transmission/default.nix index 9d3fc8ae..9fc6d140 100644 --- a/overlays/downgrade-transmission/default.nix +++ b/overlays/downgrade-transmission/default.nix @@ -1,14 +1,7 @@ -self: prev: +self: _prev: { - transmission_4 = prev.transmission_4.overrideAttrs (_: { - version = "4.0.5"; - - src = self.fetchFromGitHub { - owner = "transmission"; - repo = "transmission"; - rev = "4.0.5"; - hash = "sha256-gd1LGAhMuSyC/19wxkoE2mqVozjGPfupIPGojKY0Hn4="; - fetchSubmodules = true; - }; - }); + transmission_4 = self.callPackage ./transmission_4.nix { + fmt = self.fmt_9; + libutp = self.libutp_3_4; + }; } diff --git a/overlays/downgrade-transmission/transmission_4.nix b/overlays/downgrade-transmission/transmission_4.nix new file mode 100644 index 00000000..a49f6b9b --- /dev/null +++ b/overlays/downgrade-transmission/transmission_4.nix @@ -0,0 +1,232 @@ +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch2 +, cmake +, pkg-config +, python3 +, openssl +, curl +, libevent +, inotify-tools +, systemd +, zlib +, pcre +, libb64 +, libutp +, libdeflate +, utf8cpp +, fast-float +, fmt +, libpsl +, miniupnpc +, dht +, libnatpmp +, # Build options + enableGTK3 ? false +, gtkmm3 +, libpthread-stubs +, wrapGAppsHook3 +, enableQt5 ? false +, enableQt6 ? false +, qt5 +, qt6Packages +, nixosTests +, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd +, enableDaemon ? true +, enableCli ? true +, installLib ? false +, apparmorRulesFromClosure +}: + +let + inherit (lib) cmakeBool optionals; + + apparmorRules = apparmorRulesFromClosure { name = "transmission-daemon"; } ( + [ + curl + libdeflate + libevent + libnatpmp + libpsl + miniupnpc + openssl + pcre + zlib + ] + ++ optionals enableSystemd [ systemd ] + ++ optionals stdenv.hostPlatform.isLinux [ inotify-tools ] + ); + +in +stdenv.mkDerivation (finalAttrs: { + pname = "transmission"; + version = "4.0.5"; + + src = fetchFromGitHub { + owner = "transmission"; + repo = "transmission"; + rev = finalAttrs.version; + hash = "sha256-gd1LGAhMuSyC/19wxkoE2mqVozjGPfupIPGojKY0Hn4="; + fetchSubmodules = true; + }; + + patches = [ + (fetchpatch2 { + url = "https://github.com/transmission/transmission/commit/febfe49ca3ecab1a7142ecb34012c1f0b2bcdee8.patch?full_index=1"; + hash = "sha256-Ge0+AXf/ilfMieGBAdvvImY7JOb0gGIdeKprC37AROs="; + excludes = [ + # The submodule that we don't use (we use our miniupnp) + "third-party/miniupnp" + # Hunk fails for this one, but we don't care because we don't rely upon + # xcode definitions even for the Darwin build. + "Transmission.xcodeproj/project.pbxproj" + ]; + }) + ]; + + outputs = [ + "out" + "apparmor" + ]; + + cmakeFlags = [ + (cmakeBool "ENABLE_CLI" enableCli) + (cmakeBool "ENABLE_DAEMON" enableDaemon) + (cmakeBool "ENABLE_GTK" enableGTK3) + (cmakeBool "ENABLE_MAC" false) # requires xcodebuild + (cmakeBool "ENABLE_QT" (enableQt5 || enableQt6)) + (cmakeBool "INSTALL_LIB" installLib) + ] + ++ optionals stdenv.hostPlatform.isDarwin [ + # Transmission sets this to 10.13 if not explicitly specified, see https://github.com/transmission/transmission/blob/0be7091eb12f4eb55f6690f313ef70a66795ee72/CMakeLists.txt#L7-L16. + "-DCMAKE_OSX_DEPLOYMENT_TARGET=${stdenv.hostPlatform.darwinMinVersion}" + ]; + + postPatch = '' + # Clean third-party libraries to ensure system ones are used. + # Excluding gtest since it is hardcoded to vendored version. The rest of the listed libraries are not packaged. + pushd third-party + for f in *; do + if [[ ! $f =~ googletest|wildmat|wide-integer|jsonsl ]]; then + rm -r "$f" + fi + done + popd + rm \ + cmake/FindFastFloat.cmake \ + cmake/FindFmt.cmake \ + cmake/FindUtfCpp.cmake + # Upstream uses different config file name. + substituteInPlace CMakeLists.txt --replace 'find_package(UtfCpp)' 'find_package(utf8cpp)' + + # Use gettext even on Darwin + substituteInPlace libtransmission/utils.h \ + --replace-fail '#if defined(HAVE_GETTEXT) && !defined(__APPLE__)' '#if defined(HAVE_GETTEXT)' + ''; + + nativeBuildInputs = [ + pkg-config + cmake + python3 + ] + ++ optionals enableGTK3 [ wrapGAppsHook3 ] + ++ optionals enableQt5 [ qt5.wrapQtAppsHook ] + ++ optionals enableQt6 [ qt6Packages.wrapQtAppsHook ]; + + buildInputs = [ + curl + dht + fast-float + fmt + libb64 + libdeflate + libevent + libnatpmp + libpsl + libutp + miniupnpc + openssl + pcre + utf8cpp + zlib + ] + ++ optionals enableQt5 ( + with qt5; + [ + qttools + qtbase + ] + ) + ++ optionals enableQt6 ( + with qt6Packages; + [ + qttools + qtbase + qtsvg + ] + ) + ++ optionals enableGTK3 [ + gtkmm3 + libpthread-stubs + ] + ++ optionals enableSystemd [ systemd ] + ++ optionals stdenv.hostPlatform.isLinux [ inotify-tools ]; + + postInstall = '' + mkdir $apparmor + cat >$apparmor/bin.transmission-daemon <, + include + profile $out/bin/transmission-daemon { + include + include + include + include "${apparmorRules}" + @{PROC}/sys/kernel/random/uuid r, + @{PROC}/sys/vm/overcommit_memory r, + @{PROC}/@{pid}/environ r, + @{PROC}/@{pid}/mounts r, + /tmp/tr_session_id_* rwk, + + $out/share/transmission/public_html/** r, + + include if exists + } + EOF + install -Dm0444 -t $out/share/icons ../qt/icons/transmission.svg + ''; + + passthru.tests = { + apparmor = nixosTests.transmission_4; # starts the service with apparmor enabled + smoke-test = nixosTests.bittorrent; + }; + + meta = { + description = "Fast, easy and free BitTorrent client"; + mainProgram = + if (enableQt5 || enableQt6) then + "transmission-qt" + else if enableGTK3 then + "transmission-gtk" + else + "transmission-cli"; + longDescription = '' + Transmission is a BitTorrent client which features a simple interface + on top of a cross-platform back-end. + Feature spotlight: + * Uses fewer resources than other clients + * Native Mac, GTK and Qt GUI clients + * Daemon ideal for servers, embedded systems, and headless use + * All these can be remote controlled by Web and Terminal clients + * Bluetack (PeerGuardian) blocklists with automatic updates + * Full encryption, DHT, and PEX support + ''; + homepage = "https://www.transmissionbt.com/"; + license = with lib.licenses; [ + gpl2Plus + mit + ]; + platforms = lib.platforms.unix; + }; +}) diff --git a/pkgs/diff-flake/diff-flake b/pkgs/diff-flake/diff-flake index a2a35131..f9290b91 100755 --- a/pkgs/diff-flake/diff-flake +++ b/pkgs/diff-flake/diff-flake @@ -24,11 +24,15 @@ current_system() { nix eval --raw --impure --expr 'builtins.currentSystem' } +add_darwin() { + FLAKE_OUTPUTS+=("darwinConfigurations.\"$1\".config.system.build.toplevel") +} + add_home() { FLAKE_OUTPUTS+=("homeConfigurations.\"$1\".activationPackage") } -add_host() { +add_nixos() { FLAKE_OUTPUTS+=("nixosConfigurations.\"$1\".config.system.build.toplevel") } @@ -37,6 +41,10 @@ add_shell() { FLAKE_OUTPUTS+=("devShells.\"$(current_system)\".\"$1\".inputDerivation") } +add_system() { + FLAKE_OUTPUTS+=("systemConfigs.\"$1\".config.system.build.toplevel") +} + usage() { print_err "Usage: $0 [option]... [-- [nix build option]...]" print_err "" @@ -54,11 +62,15 @@ usage() { print_err " -p, --previous-rev" print_err " which git revision should be considered the 'previous' state," print_err " defaults to HEAD~" + print_err " --darwin [name]" + print_err " specify the name of a nix-darwin output configuration whose" + print_err " closure should be diffed, can be used multiple times" + print_err " if no host name is given, defaults to current hostname" print_err " --home [name]" print_err " specify the name of a home-manager output configuration whose" print_err " closure should be diffed, can be used multiple times" print_err " if no configuration name is given, defaults to current username" - print_err " --host [name]" + print_err " --nixos [name]" print_err " specify the name of a NixOS output configuration whose" print_err " closure should be diffed, can be used multiple times" print_err " if no host name is given, defaults to current hostname" @@ -66,6 +78,10 @@ usage() { print_err " specify a specific devShell configuration name whose closure" print_err " should be diffed, can be used multiple times" print_err " if no name is given, defaults to 'default'" + print_err " --system [name]" + print_err " specify the name of a system-manager output configuration whose" + print_err " closure should be diffed, can be used multiple times" + print_err " if no host name is given, defaults to current hostname" print_err "" print_err "when no flake outputs are specified, automatically queries for" print_err "all NixOS configurations, and devShells for current system" @@ -101,6 +117,14 @@ parse_args() { PREVIOUS_REV="$(git rev-parse "$1")" shift ;; + --darwin) + if [ $# -gt 0 ] && ! is_option "$1"; then + add_darwin "$1" + shift + else + add_darwin "$(hostname)" + fi + ;; --home) if [ $# -gt 0 ] && ! is_option "$1"; then add_home "$1" @@ -109,12 +133,12 @@ parse_args() { add_home "$USER" fi ;; - --host) + --nixos) if [ $# -gt 0 ] && ! is_option "$1"; then - add_host "$1" + add_nixos "$1" shift else - add_host "$(hostname)" + add_nixos "$(hostname)" fi ;; --shell) @@ -125,6 +149,14 @@ parse_args() { add_shell "default" fi ;; + --system) + if [ $# -gt 0 ] && ! is_option "$1"; then + add_system "$1" + shift + else + add_system "$(hostname)" + fi + ;; --) NIX_BUILD_ARGS=("$@") break @@ -138,6 +170,12 @@ parse_args() { done } +list_darwin_configurations() { + nix eval '.#darwinConfigurations' \ + --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ + --raw +} + list_home_configurations() { nix eval '.#homeConfigurations' \ --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ @@ -156,6 +194,12 @@ list_dev_shells() { --raw } +list_system_configurations() { + nix eval '.#systemConfigs' \ + --apply 'attrs: with builtins; concatStringsSep "\n" (attrNames attrs)' \ + --raw +} + diff_output() { local PREV NEW PREV="$(mktemp --dry-run)" @@ -175,15 +219,21 @@ diff_output() { parse_args "$@" if [ "${#FLAKE_OUTPUTS[@]}" -eq 0 ]; then + for darwin in $(list_darwin_configurations); do + add_darwin "$darwin" + done for home in $(list_home_configurations); do add_home "$home" done - for host in $(list_nixos_configurations); do - add_host "$host" + for nixos in $(list_nixos_configurations); do + add_nixos "$nixos" done for shell in $(list_dev_shells); do add_shell "$shell" done + for system in $(list_system_configurations); do + add_system "$system" + done fi for out in "${FLAKE_OUTPUTS[@]}"; do diff --git a/pkgs/i3-get-window-criteria/default.nix b/pkgs/i3-get-window-criteria/default.nix index 2fc840dc..cba51944 100644 --- a/pkgs/i3-get-window-criteria/default.nix +++ b/pkgs/i3-get-window-criteria/default.nix @@ -1,4 +1,4 @@ -{ lib, coreutils, gnused, makeWrapper, stdenvNoCC, xorg }: +{ lib, coreutils, gnused, makeWrapper, stdenvNoCC, xprop, xwininfo }: stdenvNoCC.mkDerivation rec { pname = "i3-get-window-criteria"; version = "0.1.0"; @@ -22,8 +22,8 @@ stdenvNoCC.mkDerivation rec { wrapperPath = lib.makeBinPath [ coreutils gnused - xorg.xprop - xorg.xwininfo + xprop + xwininfo ]; fixupPhase = '' diff --git a/templates/c++-cmake/flake.nix b/templates/c++-cmake/flake.nix index 7796f5e5..eb2767d6 100644 --- a/templates/c++-cmake/flake.nix +++ b/templates/c++-cmake/flake.nix @@ -95,7 +95,7 @@ self.packages.${system}.project ]; - packages = with pkgs; [ + packages = [ self.checks.${system}.pre-commit.enabledPackages ]; diff --git a/templates/c++-meson/flake.nix b/templates/c++-meson/flake.nix index cb14eb56..44189179 100644 --- a/templates/c++-meson/flake.nix +++ b/templates/c++-meson/flake.nix @@ -95,7 +95,7 @@ self.packages.${system}.project ]; - packages = with pkgs; [ + packages = [ self.checks.${system}.pre-commit.enabledPackages ];