adopted new syncthing flake
This commit is contained in:
parent
80092713e3
commit
395a25eff1
95
configurations/syncthing/default.nix
Normal file
95
configurations/syncthing/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
{config, ...}: {
|
||||||
|
folders = {
|
||||||
|
leyla_documents = {
|
||||||
|
id = "hvrj0-9bm1p";
|
||||||
|
};
|
||||||
|
leyla_calendar = {
|
||||||
|
id = "8oatl-1rv6w";
|
||||||
|
};
|
||||||
|
leyla_notes = {
|
||||||
|
id = "dwbuv-zffnf";
|
||||||
|
};
|
||||||
|
share = {
|
||||||
|
id = "73ot0-cxmkx";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
devices = {
|
||||||
|
defiant = {
|
||||||
|
id = "3R6E6Y4-2F7MF2I-IGB4WE6-A3SQSMV-LIBYSAM-2OXHHU2-KJ6CGIV-QNMCPAR";
|
||||||
|
folders = {
|
||||||
|
leyla_documents = {
|
||||||
|
folder = config.folders.leyla_documents;
|
||||||
|
path = "/mnt/sync/leyla/documents";
|
||||||
|
};
|
||||||
|
leyla_calendar = {
|
||||||
|
folder = config.folders.leyla_calendar;
|
||||||
|
path = "/mnt/sync/leyla/calendar";
|
||||||
|
};
|
||||||
|
leyla_notes = {
|
||||||
|
folder = config.folders.leyla_notes;
|
||||||
|
path = "/mnt/sync/leyla/notes";
|
||||||
|
};
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
path = "/mnt/sync/default/share";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
twilight = {
|
||||||
|
id = "UDIYL7V-OAZ2BI3-EJRAWFB-GZYVDWR-JNUYW3F-FFQ35MU-XBTGWEF-QD6K6QN";
|
||||||
|
folders = {
|
||||||
|
leyla_documents = {
|
||||||
|
folder = config.folders.leyla_documents;
|
||||||
|
path = "/mnt/sync/leyla/documents";
|
||||||
|
};
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
path = "/mnt/sync/default/share";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
horizon = {
|
||||||
|
id = "OGPAEU6-5UR56VL-SP7YC4Y-IMVCRTO-XFD4CYN-Z6T5TZO-PFZNAT6-4MKWPQS";
|
||||||
|
folders = {
|
||||||
|
leyla_documents = {
|
||||||
|
folder = config.folders.leyla_documents;
|
||||||
|
path = "/mnt/sync/leyla/documents";
|
||||||
|
};
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
path = "/mnt/sync/default/share";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
coven = {
|
||||||
|
id = "QGU7NN6-OMXTWVA-YCZ73S5-2O7ECTS-MUCTN4M-YH6WLEL-U4U577I-7PBNCA5";
|
||||||
|
folders = {
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ceder = {
|
||||||
|
id = "MGXUJBS-7AENXHB-7YQRNWG-QILKEJD-5462U2E-WAQW4R4-I2TVK5H-SMK6LAA";
|
||||||
|
folders = {
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
};
|
||||||
|
leyla_calendar = {
|
||||||
|
folder = config.folders.leyla_calendar;
|
||||||
|
};
|
||||||
|
leyla_notes = {
|
||||||
|
folder = config.folders.leyla_notes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
shale = {
|
||||||
|
id = "AOAXEVD-QJ2IVRA-6G44Q7Q-TGUPXU2-FWWKOBH-DPKWC5N-LBAEHWJ-7EQF4AM";
|
||||||
|
folders = {
|
||||||
|
share = {
|
||||||
|
folder = config.folders.share;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
34
flake.lock
34
flake.lock
|
@ -29,11 +29,11 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"dir": "pkgs/firefox-addons",
|
||||||
"lastModified": 1741786843,
|
"lastModified": 1741838604,
|
||||||
"narHash": "sha256-1m1krwWuROjou56kuILpYZ3imlOgpW2hPqczObinQwQ=",
|
"narHash": "sha256-ytHdrfSbbPvla43Ykd61cVkS2JLA8wBEHcnf4yLFP7Y=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nur-expressions",
|
"repo": "nur-expressions",
|
||||||
"rev": "51bc10cdd5c2ea8f2cd5adcc587ba0479409312e",
|
"rev": "e41884886e7798003973f487f37b979ee92f7d99",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -214,6 +214,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-syncthing": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1741849924,
|
||||||
|
"narHash": "sha256-5vyb1H6HtW24QVqfI56P4QVQP6vHh1jS9ULwnunCO94=",
|
||||||
|
"ref": "main",
|
||||||
|
"rev": "86bcb200c83b6a5d13b3583126b9d8dc6770613a",
|
||||||
|
"revCount": 6,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.jan-leila.com/jan-leila/nix-syncthing"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"ref": "main",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.jan-leila.com/jan-leila/nix-syncthing"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-vscode-extensions": {
|
"nix-vscode-extensions": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_3",
|
"flake-utils": "flake-utils_3",
|
||||||
|
@ -222,11 +243,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741772639,
|
"lastModified": 1741830545,
|
||||||
"narHash": "sha256-u6jSqRGsfm4Af+tUKJsJ346XwJuomL6Qxiu/BZieowU=",
|
"narHash": "sha256-SzbDILDATgMCYk2SxPYLCBVdT6mHtlyeYZDn2SZaIuU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-vscode-extensions",
|
"repo": "nix-vscode-extensions",
|
||||||
"rev": "2f079586510bc77bac539cf330edaebb9d51e0e0",
|
"rev": "28318c164b39b70a14851aed7ad0ea7f03ca417e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -276,6 +297,7 @@
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"lix-module": "lix-module",
|
"lix-module": "lix-module",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nix-syncthing": "nix-syncthing",
|
||||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# common config for syncthing
|
# common config for syncthing
|
||||||
|
nix-syncthing = {
|
||||||
|
url = "git+https://git.jan-leila.com/jan-leila/nix-syncthing?ref=main";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# disk configurations
|
# disk configurations
|
||||||
disko = {
|
disko = {
|
||||||
|
@ -73,6 +77,7 @@
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
sops-nix,
|
sops-nix,
|
||||||
|
nix-syncthing,
|
||||||
home-manager,
|
home-manager,
|
||||||
impermanence,
|
impermanence,
|
||||||
...
|
...
|
||||||
|
@ -84,6 +89,7 @@
|
||||||
mkNixosSystem = util.mkNixosSystem;
|
mkNixosSystem = util.mkNixosSystem;
|
||||||
mkDarwinSystem = util.mkDarwinSystem;
|
mkDarwinSystem = util.mkDarwinSystem;
|
||||||
mkHome = util.mkHome;
|
mkHome = util.mkHome;
|
||||||
|
syncthingConfiguration = util.syncthingConfiguration;
|
||||||
|
|
||||||
installerSystems = {
|
installerSystems = {
|
||||||
basic = mkNixosInstaller "basic" [];
|
basic = mkNixosInstaller "basic" [];
|
||||||
|
@ -153,5 +159,7 @@
|
||||||
darwinConfigurations = darwinSystems;
|
darwinConfigurations = darwinSystems;
|
||||||
|
|
||||||
homeConfigurations = homeConfigurations;
|
homeConfigurations = homeConfigurations;
|
||||||
|
|
||||||
|
syncthingConfiguration = syncthingConfiguration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
outputs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
mountDir = "/mnt/sync";
|
mountDir = "/mnt/sync";
|
||||||
|
@ -59,97 +60,24 @@ in {
|
||||||
configDir = configDir;
|
configDir = configDir;
|
||||||
overrideDevices = true;
|
overrideDevices = true;
|
||||||
overrideFolders = true;
|
overrideFolders = true;
|
||||||
settings = {
|
configuration = outputs.syncthingConfiguration;
|
||||||
devices = {
|
deviceName = config.networking.hostName;
|
||||||
ceder = {
|
|
||||||
id = "MGXUJBS-7AENXHB-7YQRNWG-QILKEJD-5462U2E-WAQW4R4-I2TVK5H-SMK6LAA";
|
|
||||||
};
|
|
||||||
coven = {
|
|
||||||
id = "QGU7NN6-OMXTWVA-YCZ73S5-2O7ECTS-MUCTN4M-YH6WLEL-U4U577I-7PBNCA5";
|
|
||||||
};
|
|
||||||
defiant = lib.mkIf (config.networking.hostName != "defiant") {
|
|
||||||
id = "3R6E6Y4-2F7MF2I-IGB4WE6-A3SQSMV-LIBYSAM-2OXHHU2-KJ6CGIV-QNMCPAR";
|
|
||||||
};
|
|
||||||
twilight = lib.mkIf (config.networking.hostName != "twilight") {
|
|
||||||
id = "UDIYL7V-OAZ2BI3-EJRAWFB-GZYVDWR-JNUYW3F-FFQ35MU-XBTGWEF-QD6K6QN";
|
|
||||||
};
|
|
||||||
horizon = lib.mkIf (config.networking.hostName != "horizon") {
|
|
||||||
id = "OGPAEU6-5UR56VL-SP7YC4Y-IMVCRTO-XFD4CYN-Z6T5TZO-PFZNAT6-4MKWPQS";
|
|
||||||
};
|
|
||||||
shale = {
|
|
||||||
id = "AOAXEVD-QJ2IVRA-6G44Q7Q-TGUPXU2-FWWKOBH-DPKWC5N-LBAEHWJ-7EQF4AM";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
folders = let
|
|
||||||
ceder = "ceder";
|
|
||||||
coven = "coven";
|
|
||||||
shale = "shale";
|
|
||||||
defiant = lib.mkIf (config.networking.hostName != "defiant") "defiant";
|
|
||||||
twilight = lib.mkIf (config.networking.hostName != "twilight") "twilight";
|
|
||||||
horizon = lib.mkIf (config.networking.hostName != "horizon") "horizon";
|
|
||||||
in
|
|
||||||
lib.mkMerge [
|
|
||||||
config.host.sync.folders.extraFolders
|
|
||||||
(lib.mkIf config.host.sync.folders.leyla.documents.enable {
|
|
||||||
"documents" = {
|
|
||||||
id = "hvrj0-9bm1p";
|
|
||||||
path = "${mountDir}/leyla/documents";
|
|
||||||
devices = [
|
|
||||||
defiant
|
|
||||||
ceder
|
|
||||||
coven
|
|
||||||
twilight
|
|
||||||
horizon
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(lib.mkIf config.host.sync.folders.share.calendar.enable {
|
|
||||||
"calendar" = {
|
|
||||||
id = "8oatl-1rv6w";
|
|
||||||
path = "${mountDir}/default/calendar";
|
|
||||||
devices = [
|
|
||||||
defiant
|
|
||||||
ceder
|
|
||||||
shale
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(lib.mkIf config.host.sync.folders.leyla.notes.enable {
|
|
||||||
"notes" = {
|
|
||||||
id = "dwbuv-zffnf";
|
|
||||||
path = "${mountDir}/leyla/notes";
|
|
||||||
devices = [
|
|
||||||
defiant
|
|
||||||
ceder
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(lib.mkIf config.host.sync.folders.share.enable {
|
|
||||||
"share" = {
|
|
||||||
id = "73ot0-cxmkx";
|
|
||||||
path = "${mountDir}/default/share";
|
|
||||||
devices = [
|
|
||||||
defiant
|
|
||||||
ceder
|
|
||||||
coven
|
|
||||||
twilight
|
|
||||||
horizon
|
|
||||||
shale
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf config.host.impermanence.enable {
|
(lib.mkIf config.host.impermanence.enable {
|
||||||
assertions = [
|
assertions =
|
||||||
{
|
[
|
||||||
assertion = config.services.syncthing.configDir == configDir;
|
{
|
||||||
message = "syncthing config dir does not match persistence";
|
assertion = config.services.syncthing.configDir == configDir;
|
||||||
}
|
message = "syncthing config dir does not match persistence";
|
||||||
];
|
}
|
||||||
|
]
|
||||||
|
++ lib.attrsets.mapAttrsToList (_: folder: {
|
||||||
|
assertion = lib.strings.hasPrefix mountDir folder.path;
|
||||||
|
message = "syncthing folder ${folder.label} is stored at ${folder.path} which not under the persisted path of ${mountDir}";
|
||||||
|
})
|
||||||
|
config.services.syncthing.folders;
|
||||||
environment.persistence = {
|
environment.persistence = {
|
||||||
"/persist/system/root" = {
|
"/persist/system/root" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
home-manager = inputs.home-manager;
|
home-manager = inputs.home-manager;
|
||||||
nix-darwin = inputs.nix-darwin;
|
nix-darwin = inputs.nix-darwin;
|
||||||
sops-nix = inputs.sops-nix;
|
sops-nix = inputs.sops-nix;
|
||||||
|
nix-syncthing = inputs.nix-syncthing;
|
||||||
disko = inputs.disko;
|
disko = inputs.disko;
|
||||||
impermanence = inputs.impermanence;
|
impermanence = inputs.impermanence;
|
||||||
lix-module = inputs.lix-module;
|
lix-module = inputs.lix-module;
|
||||||
|
@ -73,6 +74,7 @@ in {
|
||||||
system-modules
|
system-modules
|
||||||
++ [
|
++ [
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
|
nix-syncthing.nixosModules.syncthing
|
||||||
impermanence.nixosModules.impermanence
|
impermanence.nixosModules.impermanence
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
disko.nixosModules.disko
|
disko.nixosModules.disko
|
||||||
|
@ -107,4 +109,10 @@ in {
|
||||||
../configurations/home-manager/${user}
|
../configurations/home-manager/${user}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
syncthingConfiguration = nix-syncthing.lib.syncthingConfiguration {
|
||||||
|
modules = [
|
||||||
|
(import ../configurations/syncthing)
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue