Compare commits
16 Commits
d3d3987f86
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3861962566 | |||
| 4361d9b9b6 | |||
| 4493790d72 | |||
| 7d5a0d4759 | |||
| f7164dd172 | |||
| 81a729ea06 | |||
| dc74538cfe | |||
| 28d8eb7ca9 | |||
| 42b1578efa | |||
| 4f105c81c2 | |||
| 0abd3121fb | |||
| d88ee49aaf | |||
| 647b20b934 | |||
| 6f0f586fb6 | |||
| be4a060e94 | |||
| 1ba3bdf8d6 |
21
flake.lock
generated
21
flake.lock
generated
@@ -404,6 +404,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"monorepo": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1788059616,
|
||||||
|
"narHash": "sha256-HBYT3h0vXRsvmgPOhUW3kgPTkgdl73PEwRTJQ5X48aM=",
|
||||||
|
"path": "/home/alexion/dev",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"path": "/home/alexion/dev",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -542,8 +557,12 @@
|
|||||||
"firefox-addons": "firefox-addons",
|
"firefox-addons": "firefox-addons",
|
||||||
"gitea-axi": "gitea-axi",
|
"gitea-axi": "gitea-axi",
|
||||||
"home-manager": "home-manager_3",
|
"home-manager": "home-manager_3",
|
||||||
|
"monorepo": "monorepo",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": [
|
||||||
|
"monorepo",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"nixvim": "nixvim",
|
"nixvim": "nixvim",
|
||||||
|
|||||||
12
flake.nix
12
flake.nix
@@ -2,8 +2,10 @@
|
|||||||
description = "Alexion's NixOS configuration — one flake for every host";
|
description = "Alexion's NixOS configuration — one flake for every host";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# Base channel.
|
monorepo.url = "path:/home/alexion/dev";
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
|
# Base package set shared with the monorepo.
|
||||||
|
nixpkgs.follows = "monorepo/nixpkgs";
|
||||||
|
|
||||||
# Fresher packages, reachable per-package as `unstable.<name>`.
|
# Fresher packages, reachable per-package as `unstable.<name>`.
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
@@ -76,13 +78,9 @@
|
|||||||
{ self, nixpkgs, ... }@inputs:
|
{ self, nixpkgs, ... }@inputs:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
flake = import ./flake { inherit lib inputs self; };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Every host under hosts/ is discovered and built.
|
inherit (import ./flake { inherit lib inputs self; }) nixosConfigurations;
|
||||||
nixosConfigurations = flake.mkHosts {
|
|
||||||
root = self + "/hosts";
|
|
||||||
};
|
|
||||||
|
|
||||||
# A project shell for agent-local resources that should travel with this
|
# A project shell for agent-local resources that should travel with this
|
||||||
# checkout rather than the operator's global profile.
|
# checkout rather than the operator's global profile.
|
||||||
|
|||||||
@@ -4,55 +4,50 @@
|
|||||||
self,
|
self,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
# TODO: refactor the registry code
|
|
||||||
registryAssembly = import ./registry.nix { inherit lib self; };
|
|
||||||
|
|
||||||
util = import ../lib { inherit lib; };
|
util = import ../lib { inherit lib; };
|
||||||
mkModules = import ./module.nix { inherit util; };
|
|
||||||
|
|
||||||
modules = mkModules {
|
registry = import ./registry.nix {
|
||||||
|
inherit lib;
|
||||||
|
hosts = self.nixosConfigurations;
|
||||||
|
root = self + "/registry";
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = import ./module.nix {
|
||||||
|
inherit util;
|
||||||
root = self + "/modules";
|
root = self + "/modules";
|
||||||
};
|
};
|
||||||
|
|
||||||
guestModules = guests.mkGuests {
|
guestModules = import ./guest.nix {
|
||||||
|
inherit
|
||||||
|
inputs
|
||||||
|
lib
|
||||||
|
registry
|
||||||
|
specialArgs
|
||||||
|
util
|
||||||
|
;
|
||||||
|
repositoryModules = modules;
|
||||||
root = self + "/guests";
|
root = self + "/guests";
|
||||||
};
|
};
|
||||||
|
|
||||||
#----------------------------------------------------------
|
|
||||||
|
|
||||||
collectedRegistry = registryAssembly.collect { hosts = self.nixosConfigurations; };
|
|
||||||
|
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
inputs
|
inputs
|
||||||
self
|
self
|
||||||
util
|
util
|
||||||
;
|
;
|
||||||
registry = collectedRegistry;
|
registry = registry.collected;
|
||||||
};
|
};
|
||||||
|
in
|
||||||
guests = import ./guest.nix {
|
{
|
||||||
inherit
|
nixosConfigurations = import ./host.nix {
|
||||||
inputs
|
|
||||||
lib
|
|
||||||
specialArgs
|
|
||||||
registryAssembly
|
|
||||||
util
|
|
||||||
;
|
|
||||||
repositoryModules = modules;
|
|
||||||
};
|
|
||||||
|
|
||||||
hosts = import ./host.nix {
|
|
||||||
inherit
|
inherit
|
||||||
inputs
|
inputs
|
||||||
lib
|
lib
|
||||||
specialArgs
|
specialArgs
|
||||||
guestModules
|
guestModules
|
||||||
registryAssembly
|
|
||||||
;
|
;
|
||||||
|
registryModule = registry.module;
|
||||||
repositoryModules = modules;
|
repositoryModules = modules;
|
||||||
|
root = self + "/hosts";
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit (hosts) mkHosts;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
|
root,
|
||||||
specialArgs,
|
specialArgs,
|
||||||
repositoryModules,
|
repositoryModules,
|
||||||
registryAssembly,
|
registry,
|
||||||
util,
|
util,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
@@ -65,7 +66,7 @@ let
|
|||||||
enable = lib.mkEnableOption "a reverse-proxy route for this guest";
|
enable = lib.mkEnableOption "a reverse-proxy route for this guest";
|
||||||
|
|
||||||
route = lib.mkOption {
|
route = lib.mkOption {
|
||||||
type = registryAssembly.definitions.route.type;
|
type = registry.types.route;
|
||||||
description = "Route registry entry published for this guest.";
|
description = "Route registry entry published for this guest.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -247,7 +248,7 @@ let
|
|||||||
inputs.stylix.nixosModules.stylix
|
inputs.stylix.nixosModules.stylix
|
||||||
|
|
||||||
repositoryModules
|
repositoryModules
|
||||||
registryAssembly.module
|
registry.module
|
||||||
cfg.interior
|
cfg.interior
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -268,15 +269,11 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
let
|
||||||
|
files = util.collectNixFiles root;
|
||||||
|
guestFiles = lib.filterAttrs (file: type: type == "regular" && lib.hasSuffix ".nix" file) (builtins.readDir root);
|
||||||
|
names = map (file: lib.removeSuffix ".nix" file) (lib.attrNames guestFiles);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
mkGuests =
|
imports = files ++ map mkGuest names;
|
||||||
{ root }:
|
|
||||||
let
|
|
||||||
files = util.collectNixFiles root;
|
|
||||||
guestFiles = lib.filterAttrs (file: type: type == "regular" && lib.hasSuffix ".nix" file) (builtins.readDir root);
|
|
||||||
names = map (file: lib.removeSuffix ".nix" file) (lib.attrNames guestFiles);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = files ++ map mkGuest names;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
|
root,
|
||||||
specialArgs,
|
specialArgs,
|
||||||
repositoryModules,
|
repositoryModules,
|
||||||
|
|
||||||
guestModules,
|
guestModules,
|
||||||
# TODO refactor registry
|
registryModule,
|
||||||
registryAssembly,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mkHost =
|
mkHost =
|
||||||
@@ -26,7 +26,7 @@ let
|
|||||||
guestModules
|
guestModules
|
||||||
|
|
||||||
# TODO: refactor
|
# TODO: refactor
|
||||||
registryAssembly.module (root + "/${name}")
|
registryModule (root + "/${name}")
|
||||||
|
|
||||||
{
|
{
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
@@ -35,15 +35,11 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
let
|
||||||
mkHosts =
|
directories = lib.filterAttrs (_name: type: type == "directory") (builtins.readDir root);
|
||||||
{ root }:
|
names = lib.attrNames directories;
|
||||||
let
|
in
|
||||||
directories = lib.filterAttrs (_name: type: type == "directory") (builtins.readDir root);
|
lib.genAttrs names (
|
||||||
names = lib.attrNames directories;
|
name:
|
||||||
in
|
mkHost { inherit root name; }
|
||||||
lib.genAttrs names (
|
)
|
||||||
name:
|
|
||||||
mkHost { inherit root name; }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{ util }:
|
{
|
||||||
{ root }:
|
root,
|
||||||
|
util,
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
imports = util.collectNixFiles root;
|
imports = util.collectNixFiles root;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,16 @@
|
|||||||
{ lib, self }:
|
{ hosts, lib, root }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
checkType = lib.types.submodule {
|
||||||
all
|
|
||||||
concatLists
|
|
||||||
concatMapStringsSep
|
|
||||||
filter
|
|
||||||
filterAttrs
|
|
||||||
foldl'
|
|
||||||
hasAttr
|
|
||||||
hasSuffix
|
|
||||||
mapAttrs
|
|
||||||
mapAttrs'
|
|
||||||
mapAttrsToList
|
|
||||||
mkOption
|
|
||||||
nameValuePair
|
|
||||||
removeSuffix
|
|
||||||
types
|
|
||||||
unique
|
|
||||||
;
|
|
||||||
|
|
||||||
checkType = types.submodule {
|
|
||||||
options = {
|
options = {
|
||||||
assertion = mkOption {
|
assertion = lib.mkOption {
|
||||||
type = types.functionTo types.bool;
|
type = lib.types.functionTo lib.types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
Predicate run against this registry's flattened collected entries.
|
Predicate run against this registry's flattened collected entries.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
message = mkOption {
|
message = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Error message shown when this registry validation check fails.
|
Error message shown when this registry validation check fails.
|
||||||
'';
|
'';
|
||||||
@@ -38,7 +19,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
predicates = {
|
predicates = {
|
||||||
uniqueValue = value: entries: builtins.length (unique (map value entries)) == builtins.length entries;
|
uniqueValue = value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
registryLib = lib // {
|
registryLib = lib // {
|
||||||
@@ -49,23 +30,23 @@ let
|
|||||||
|
|
||||||
registryDefinitionModule = {
|
registryDefinitionModule = {
|
||||||
options = {
|
options = {
|
||||||
type = mkOption {
|
type = lib.mkOption {
|
||||||
type = types.raw;
|
type = lib.types.raw;
|
||||||
description = ''
|
description = ''
|
||||||
NixOS option type for one registry entry.
|
NixOS option type for one registry entry.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
replicate = mkOption {
|
replicate = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether collected entries are merged and published under every host key.
|
Whether collected entries are merged and published under every host key.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = mkOption {
|
checks = lib.mkOption {
|
||||||
type = types.listOf checkType;
|
type = lib.types.listOf checkType;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Validation checks for this registry's flattened collected entries.
|
Validation checks for this registry's flattened collected entries.
|
||||||
@@ -74,10 +55,10 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
registryName = fileName: removeSuffix ".nix" fileName;
|
registryName = fileName: lib.removeSuffix ".nix" fileName;
|
||||||
|
|
||||||
registryOption = registry: mkOption {
|
registryOption = registry: lib.mkOption {
|
||||||
type = types.attrsOf (types.attrsOf registry.type);
|
type = lib.types.attrsOf (lib.types.attrsOf registry.type);
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Lazily collected fleet-visible registry entries, nested by host and entry name.
|
Lazily collected fleet-visible registry entries, nested by host and entry name.
|
||||||
@@ -98,19 +79,19 @@ let
|
|||||||
inherit (evaluated.config) type replicate checks;
|
inherit (evaluated.config) type replicate checks;
|
||||||
};
|
};
|
||||||
|
|
||||||
definitions = mapAttrs' (
|
definitions = lib.mapAttrs' (
|
||||||
name: type:
|
name: type:
|
||||||
let
|
let
|
||||||
path = self + "/registry/${name}";
|
path = root + "/${name}";
|
||||||
in
|
in
|
||||||
nameValuePair (registryName name) (mkRegistry path)
|
lib.nameValuePair (registryName name) (mkRegistry path)
|
||||||
) (filterAttrs (name: type: type == "regular" && hasSuffix ".nix" name) (builtins.readDir (self + "/registry")));
|
) (lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) (builtins.readDir root));
|
||||||
|
|
||||||
flattenRegistryEntries = registryName: data:
|
flattenRegistryEntries = registryName: data:
|
||||||
concatLists (
|
lib.concatLists (
|
||||||
mapAttrsToList (
|
lib.mapAttrsToList (
|
||||||
host: entries:
|
host: entries:
|
||||||
mapAttrsToList (entry: value: {
|
lib.mapAttrsToList (entry: value: {
|
||||||
path = "registry.${registryName}.${host}.${entry}";
|
path = "registry.${registryName}.${host}.${entry}";
|
||||||
inherit host entry value;
|
inherit host entry value;
|
||||||
}) entries
|
}) entries
|
||||||
@@ -118,17 +99,17 @@ let
|
|||||||
);
|
);
|
||||||
|
|
||||||
rawDeclarations = registryName: hosts:
|
rawDeclarations = registryName: hosts:
|
||||||
mapAttrs (_hostName: host: host.config.registry.${registryName} or { }) hosts;
|
lib.mapAttrs (_hostName: host: host.config.registry.${registryName} or { }) hosts;
|
||||||
|
|
||||||
replicatedEntries = registryName: raw:
|
replicatedEntries = registryName: raw:
|
||||||
let
|
let
|
||||||
entries = concatLists (
|
entries = lib.concatLists (
|
||||||
concatLists (
|
lib.concatLists (
|
||||||
mapAttrsToList (
|
lib.mapAttrsToList (
|
||||||
_evalHost: hostDeclarations:
|
_evalHost: hostDeclarations:
|
||||||
mapAttrsToList (
|
lib.mapAttrsToList (
|
||||||
hostName: declarations:
|
hostName: declarations:
|
||||||
mapAttrsToList (entryName: value: {
|
lib.mapAttrsToList (entryName: value: {
|
||||||
path = "registry.${registryName}.${hostName}.${entryName}";
|
path = "registry.${registryName}.${hostName}.${entryName}";
|
||||||
inherit entryName value;
|
inherit entryName value;
|
||||||
}) declarations
|
}) declarations
|
||||||
@@ -137,9 +118,9 @@ let
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
foldl' (
|
lib.foldl' (
|
||||||
acc: entry:
|
acc: entry:
|
||||||
if hasAttr entry.entryName acc then
|
if lib.hasAttr entry.entryName acc then
|
||||||
if acc.${entry.entryName}.value == entry.value then
|
if acc.${entry.entryName}.value == entry.value then
|
||||||
acc
|
acc
|
||||||
else
|
else
|
||||||
@@ -152,13 +133,13 @@ let
|
|||||||
|
|
||||||
replicatedData = registryName: hosts: raw:
|
replicatedData = registryName: hosts: raw:
|
||||||
let
|
let
|
||||||
entries = mapAttrs (_entryName: entry: entry.value) (replicatedEntries registryName raw);
|
entries = lib.mapAttrs (_entryName: entry: entry.value) (replicatedEntries registryName raw);
|
||||||
in
|
in
|
||||||
mapAttrs (_hostName: _host: entries) hosts;
|
lib.mapAttrs (_hostName: _host: entries) hosts;
|
||||||
|
|
||||||
validationAssertions = data:
|
validationAssertions = data:
|
||||||
concatLists (
|
lib.concatLists (
|
||||||
mapAttrsToList (
|
lib.mapAttrsToList (
|
||||||
registryName: registry:
|
registryName: registry:
|
||||||
let
|
let
|
||||||
entries = flattenRegistryEntries registryName data.${registryName};
|
entries = flattenRegistryEntries registryName data.${registryName};
|
||||||
@@ -173,28 +154,28 @@ let
|
|||||||
assertValid = data:
|
assertValid = data:
|
||||||
let
|
let
|
||||||
assertions = validationAssertions data;
|
assertions = validationAssertions data;
|
||||||
failures = filter (assertion: !assertion.assertion) assertions;
|
failures = lib.filter (assertion: !assertion.assertion) assertions;
|
||||||
in
|
in
|
||||||
assert lib.assertMsg (all (assertion: assertion.assertion) assertions) (
|
assert lib.assertMsg (lib.all (assertion: assertion.assertion) assertions) (
|
||||||
concatMapStringsSep "\n" (assertion: assertion.message) failures
|
lib.concatMapStringsSep "\n" (assertion: assertion.message) failures
|
||||||
);
|
);
|
||||||
data;
|
data;
|
||||||
|
|
||||||
join = registry: host: entry:
|
join = registry: host: entry:
|
||||||
filterAttrs (_name: value: value != null) (
|
lib.filterAttrs (_name: value: value != null) (
|
||||||
mapAttrs (registryName: _registry: (registry.${registryName}.${host} or { }).${entry} or null) definitions
|
lib.mapAttrs (registryName: _registry: (registry.${registryName}.${host} or { }).${entry} or null) definitions
|
||||||
);
|
);
|
||||||
|
|
||||||
collectData =
|
collectData =
|
||||||
{ hosts }:
|
{ hosts }:
|
||||||
let
|
let
|
||||||
raw = mapAttrs (registryName: _registry: rawDeclarations registryName hosts) definitions;
|
raw = lib.mapAttrs (registryName: _registry: rawDeclarations registryName hosts) definitions;
|
||||||
data = mapAttrs (
|
data = lib.mapAttrs (
|
||||||
registryName: registry:
|
registryName: registry:
|
||||||
if registry.replicate or false then
|
if registry.replicate or false then
|
||||||
replicatedData registryName hosts raw.${registryName}
|
replicatedData registryName hosts raw.${registryName}
|
||||||
else
|
else
|
||||||
mapAttrs (hostName: host: host.config.registry.${registryName}.${hostName} or { }) hosts
|
lib.mapAttrs (hostName: host: host.config.registry.${registryName}.${hostName} or { }) hosts
|
||||||
) definitions;
|
) definitions;
|
||||||
in
|
in
|
||||||
assertValid data;
|
assertValid data;
|
||||||
@@ -206,11 +187,11 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit definitions predicates;
|
types = lib.mapAttrs (_name: definition: definition.type) definitions;
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
options.registry = mapAttrs (_name: registry: registryOption registry) definitions;
|
options.registry = lib.mapAttrs (_name: registry: registryOption registry) definitions;
|
||||||
};
|
};
|
||||||
|
|
||||||
collect = args: withOperations (collectData args);
|
collected = withOperations (collectData { inherit hosts; });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,5 +121,6 @@ in
|
|||||||
modules.shell.nvim.enable = lib.mkDefault true;
|
modules.shell.nvim.enable = lib.mkDefault true;
|
||||||
modules.shell.git.enable = lib.mkDefault true;
|
modules.shell.git.enable = lib.mkDefault true;
|
||||||
modules.shell.direnv.enable = lib.mkDefault true;
|
modules.shell.direnv.enable = lib.mkDefault true;
|
||||||
|
modules.shell.yazi.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
18
modules/desktop/apps/ghostty.nix
Normal file
18
modules/desktop/apps/ghostty.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# Ghostty as the desktop terminal.
|
||||||
|
let
|
||||||
|
cfg = config.modules.desktop.apps.ghostty;
|
||||||
|
user = config.user.name;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.desktop.apps.ghostty.enable = lib.mkEnableOption "Ghostty as the desktop terminal";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home-manager.users.${user}.home.packages = [ pkgs.ghostty ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,8 +9,8 @@ in
|
|||||||
# Each piece is turned on at default priority, so a host can still override
|
# Each piece is turned on at default priority, so a host can still override
|
||||||
# any one of them while the single flag above enables the whole desktop.
|
# any one of them while the single flag above enables the whole desktop.
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
modules.desktop.apps.alacritty.enable = lib.mkDefault true;
|
|
||||||
modules.desktop.apps.firefox.enable = lib.mkDefault true;
|
modules.desktop.apps.firefox.enable = lib.mkDefault true;
|
||||||
|
modules.desktop.apps.ghostty.enable = lib.mkDefault true;
|
||||||
modules.desktop.session.hyprland.enable = lib.mkDefault true;
|
modules.desktop.session.hyprland.enable = lib.mkDefault true;
|
||||||
modules.desktop.session.hyprland.hypridle.enable = lib.mkDefault true;
|
modules.desktop.session.hyprland.hypridle.enable = lib.mkDefault true;
|
||||||
modules.desktop.session.hyprland.hyprlock.enable = lib.mkDefault true;
|
modules.desktop.session.hyprland.hyprlock.enable = lib.mkDefault true;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ in
|
|||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
"$mod" = "SUPER";
|
"$mod" = "SUPER";
|
||||||
"$terminal" = "alacritty";
|
"$terminal" = "ghostty";
|
||||||
|
|
||||||
# Session variables handed to the compositor directly.
|
# Session variables handed to the compositor directly.
|
||||||
# UWSM launches the session without the shell profile that would carry
|
# UWSM launches the session without the shell profile that would carry
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ in
|
|||||||
window-rewrite-default = g "f2d0";
|
window-rewrite-default = g "f2d0";
|
||||||
window-rewrite = {
|
window-rewrite = {
|
||||||
"class<Alacritty>" = g "f120";
|
"class<Alacritty>" = g "f120";
|
||||||
|
"class<com.mitchellh.ghostty>" = g "f120";
|
||||||
"class<.*[Ff]irefox.*>" = g "f269";
|
"class<.*[Ff]irefox.*>" = g "f269";
|
||||||
"class<chromium.*>" = g "f268";
|
"class<chromium.*>" = g "f268";
|
||||||
"class<[Cc]ode>" = g "f121";
|
"class<[Cc]ode>" = g "f121";
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ in
|
|||||||
# nix-direnv caches the evaluated shell so re-entering a directory is instant
|
# nix-direnv caches the evaluated shell so re-entering a directory is instant
|
||||||
# instead of re-running `nix develop`, and adds the `use flake` stdlib helper.
|
# instead of re-running `nix develop`, and adds the `use flake` stdlib helper.
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
|
stdlib = builtins.readFile ./repo-flake.sh;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
33
modules/shell/direnv/repo-flake.sh
Normal file
33
modules/shell/direnv/repo-flake.sh
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
if declare -f use_flake >/dev/null; then
|
||||||
|
__dotfiles_use_flake_definition="$(declare -f use_flake)"
|
||||||
|
eval "${__dotfiles_use_flake_definition/use_flake/__dotfiles_nix_direnv_use_flake}"
|
||||||
|
unset __dotfiles_use_flake_definition
|
||||||
|
|
||||||
|
use_flake() {
|
||||||
|
local flake_expr="${1:-.}"
|
||||||
|
|
||||||
|
if [[ "$flake_expr" == //* ]]; then
|
||||||
|
local git_root
|
||||||
|
if ! git_root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
|
||||||
|
log_error 'use flake // requires a Git repository'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local flake_suffix="${flake_expr#//}"
|
||||||
|
if [[ -n "$flake_suffix" && "$flake_suffix" != \#* && "$flake_suffix" != /* ]]; then
|
||||||
|
flake_expr="path:${git_root}/${flake_suffix}"
|
||||||
|
else
|
||||||
|
flake_expr="path:${git_root}${flake_suffix}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
shift
|
||||||
|
__dotfiles_nix_direnv_use_flake "$flake_expr" "$@"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
__dotfiles_nix_direnv_use_flake "$@"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
log_error 'nix-direnv must define use_flake before the // wrapper loads'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
@@ -38,6 +38,9 @@ in
|
|||||||
|
|
||||||
[ui]
|
[ui]
|
||||||
prompt_new_tab_name = false
|
prompt_new_tab_name = false
|
||||||
|
|
||||||
|
[experimental]
|
||||||
|
kitty_graphics = true
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,16 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Soft-wrap prose buffers without inserting line breaks.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = { "gitcommit", "markdown", "text" },
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.linebreak = true
|
||||||
|
vim.opt_local.breakindent = true
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Turn line blame off again once the Neogit status buffer is closed.
|
-- Turn line blame off again once the Neogit status buffer is closed.
|
||||||
vim.api.nvim_create_autocmd("BufUnload", {
|
vim.api.nvim_create_autocmd("BufUnload", {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
|
|||||||
@@ -92,6 +92,18 @@ in
|
|||||||
action = "<cmd>nohlsearch<CR>";
|
action = "<cmd>nohlsearch<CR>";
|
||||||
options.desc = "Clear search highlight";
|
options.desc = "Clear search highlight";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "j";
|
||||||
|
action = "gj";
|
||||||
|
options.desc = "Move down by display line";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "k";
|
||||||
|
action = "gk";
|
||||||
|
options.desc = "Move up by display line";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<leader>e";
|
key = "<leader>e";
|
||||||
|
|||||||
32
modules/shell/yazi.nix
Normal file
32
modules/shell/yazi.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# Yazi, a terminal file manager.
|
||||||
|
let
|
||||||
|
cfg = config.modules.shell.yazi;
|
||||||
|
user = config.user.name;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.shell.yazi.enable = lib.mkEnableOption "Yazi, a terminal file manager";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home-manager.users.${user}.programs.yazi = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
fd
|
||||||
|
ffmpegthumbnailer
|
||||||
|
fzf
|
||||||
|
imagemagick
|
||||||
|
jq
|
||||||
|
poppler
|
||||||
|
ripgrep
|
||||||
|
unar
|
||||||
|
zoxide
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user