mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
tests: various minor cleanups
This commit is contained in:
parent
19c509a6fa
commit
eec2272999
41 changed files with 680 additions and 747 deletions
|
@ -1,17 +1,13 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file."executable" = {
|
||||
text = "";
|
||||
executable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/executable
|
||||
assertFileIsExecutable home-files/executable;
|
||||
'';
|
||||
home.file."executable" = {
|
||||
text = "";
|
||||
executable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/executable
|
||||
assertFileIsExecutable home-files/executable;
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file.".hidden".source = ./.hidden;
|
||||
home.file.".hidden".source = ./.hidden;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.hidden;
|
||||
assertFileContent home-files/.hidden ${
|
||||
builtins.path {
|
||||
path = ./.hidden;
|
||||
name = "expected";
|
||||
}
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.hidden;
|
||||
assertFileContent home-files/.hidden ${
|
||||
builtins.path {
|
||||
path = ./.hidden;
|
||||
name = "expected";
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,29 +1,25 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, ... }:
|
||||
|
||||
let
|
||||
|
||||
filePath = ./. + "/source with spaces!";
|
||||
|
||||
in {
|
||||
config = {
|
||||
home.file."oos".source = config.lib.file.mkOutOfStoreSymlink filePath;
|
||||
home.file."oos".source = config.lib.file.mkOutOfStoreSymlink filePath;
|
||||
|
||||
nmt.script = ''
|
||||
assertLinkExists "home-files/oos"
|
||||
nmt.script = ''
|
||||
assertLinkExists "home-files/oos"
|
||||
|
||||
storePath="$(readlink $TESTED/home-files/oos)"
|
||||
storePath="$(readlink $TESTED/home-files/oos)"
|
||||
|
||||
if [[ ! -L $storePath ]]; then
|
||||
fail "Expected $storePath to be a symbolic link, but it was not."
|
||||
fi
|
||||
if [[ ! -L $storePath ]]; then
|
||||
fail "Expected $storePath to be a symbolic link, but it was not."
|
||||
fi
|
||||
|
||||
actual="$(readlink "$storePath")"
|
||||
expected="${toString filePath}"
|
||||
if [[ $actual != $expected ]]; then
|
||||
fail "Symlink home-files/oos should point to $expected via the Nix store, but it actually points to $actual."
|
||||
fi
|
||||
'';
|
||||
};
|
||||
actual="$(readlink "$storePath")"
|
||||
expected="${toString filePath}"
|
||||
if [[ $actual != $expected ]]; then
|
||||
fail "Symlink home-files/oos should point to $expected via the Nix store, but it actually points to $actual."
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file."source with spaces!".source = ./. + "/source with spaces!";
|
||||
home.file."source with spaces!".source = ./. + "/source with spaces!";
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists 'home-files/source with spaces!';
|
||||
assertFileContent 'home-files/source with spaces!' \
|
||||
${
|
||||
builtins.path {
|
||||
path = ./. + "/source with spaces!";
|
||||
name = "source-with-spaces-expected";
|
||||
}
|
||||
nmt.script = ''
|
||||
assertFileExists 'home-files/source with spaces!';
|
||||
assertFileContent 'home-files/source with spaces!' \
|
||||
${
|
||||
builtins.path {
|
||||
path = ./. + "/source with spaces!";
|
||||
name = "source-with-spaces-expected";
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file = {
|
||||
conflict1 = {
|
||||
text = "";
|
||||
target = "baz";
|
||||
};
|
||||
conflict2 = {
|
||||
source = ./target-conflict.nix;
|
||||
target = "baz";
|
||||
};
|
||||
home.file = {
|
||||
conflict1 = {
|
||||
text = "";
|
||||
target = "baz";
|
||||
};
|
||||
conflict2 = {
|
||||
source = ./target-conflict.nix;
|
||||
target = "baz";
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [''
|
||||
Conflicting managed target files: baz
|
||||
|
||||
This may happen, for example, if you have a configuration similar to
|
||||
|
||||
home.file = {
|
||||
conflict1 = { source = ./foo.nix; target = "baz"; };
|
||||
conflict2 = { source = ./bar.nix; target = "baz"; };
|
||||
}''];
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [''
|
||||
Conflicting managed target files: baz
|
||||
|
||||
This may happen, for example, if you have a configuration similar to
|
||||
|
||||
home.file = {
|
||||
conflict1 = { source = ./foo.nix; target = "baz"; };
|
||||
conflict2 = { source = ./bar.nix; target = "baz"; };
|
||||
}''];
|
||||
}
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file."$HOME/$FOO/bar baz".text = "blah";
|
||||
home.file."$HOME/$FOO/bar baz".text = "blah";
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists 'home-files/$HOME/$FOO/bar baz';
|
||||
assertFileContent 'home-files/$HOME/$FOO/bar baz' \
|
||||
${pkgs.writeText "expected" "blah"}
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
assertFileExists 'home-files/$HOME/$FOO/bar baz';
|
||||
assertFileContent 'home-files/$HOME/$FOO/bar baz' \
|
||||
${builtins.toFile "expected" "blah"}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.file."using-text".text = ''
|
||||
This is the
|
||||
expected text.
|
||||
'';
|
||||
home.file."using-text".text = ''
|
||||
This is the
|
||||
expected text.
|
||||
'';
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/using-text
|
||||
assertFileIsNotExecutable home-files/using-text
|
||||
assertFileContent home-files/using-text ${./text-expected.txt}
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/using-text
|
||||
assertFileIsNotExecutable home-files/using-text
|
||||
assertFileContent home-files/using-text ${./text-expected.txt}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,116 +1,116 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
boolToString = bool: if bool then "true" else "false";
|
||||
backups = config.programs.borgmatic.backups;
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" "/mnt/disk2" ];
|
||||
extraConfig = {
|
||||
one_file_system = true;
|
||||
exclude_patterns = [ "*.swp" ];
|
||||
};
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" "/mnt/disk2" ];
|
||||
extraConfig = {
|
||||
one_file_system = true;
|
||||
exclude_patterns = [ "*.swp" ];
|
||||
};
|
||||
};
|
||||
|
||||
storage = {
|
||||
encryptionPasscommand = "fetch-the-password.sh";
|
||||
extraConfig = { checkpoint_interval = 200; };
|
||||
};
|
||||
storage = {
|
||||
encryptionPasscommand = "fetch-the-password.sh";
|
||||
extraConfig = { checkpoint_interval = 200; };
|
||||
};
|
||||
|
||||
retention = {
|
||||
keepWithin = "14d";
|
||||
keepSecondly = 12;
|
||||
extraConfig = { prefix = "hostname"; };
|
||||
};
|
||||
retention = {
|
||||
keepWithin = "14d";
|
||||
keepSecondly = 12;
|
||||
extraConfig = { prefix = "hostname"; };
|
||||
};
|
||||
|
||||
consistency = {
|
||||
checks = [
|
||||
{
|
||||
name = "repository";
|
||||
frequency = "2 weeks";
|
||||
}
|
||||
{
|
||||
name = "archives";
|
||||
frequency = "4 weeks";
|
||||
}
|
||||
];
|
||||
consistency = {
|
||||
checks = [
|
||||
{
|
||||
name = "repository";
|
||||
frequency = "2 weeks";
|
||||
}
|
||||
{
|
||||
name = "archives";
|
||||
frequency = "4 weeks";
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = { prefix = "hostname"; };
|
||||
};
|
||||
extraConfig = { prefix = "hostname"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.source_directories[0]]="${
|
||||
builtins.elemAt backups.main.location.sourceDirectories 0
|
||||
}"
|
||||
expectations[location.repositories[0]]="${
|
||||
builtins.elemAt backups.main.location.repositories 0
|
||||
}"
|
||||
expectations[location.repositories[1]]="${
|
||||
builtins.elemAt backups.main.location.repositories 1
|
||||
}"
|
||||
expectations[location.one_file_system]="${
|
||||
boolToString backups.main.location.extraConfig.one_file_system
|
||||
}"
|
||||
expectations[location.exclude_patterns[0]]="${
|
||||
builtins.elemAt backups.main.location.extraConfig.exclude_patterns 0
|
||||
}"
|
||||
|
||||
expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}"
|
||||
expectations[storage.checkpoint_interval]="${
|
||||
toString backups.main.storage.extraConfig.checkpoint_interval
|
||||
}"
|
||||
|
||||
expectations[retention.keep_within]="${backups.main.retention.keepWithin}"
|
||||
expectations[retention.keep_secondly]="${
|
||||
toString backups.main.retention.keepSecondly
|
||||
}"
|
||||
expectations[retention.prefix]="${backups.main.retention.extraConfig.prefix}"
|
||||
|
||||
expectations[consistency.checks[0].name]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 0).name
|
||||
}"
|
||||
expectations[consistency.checks[0].frequency]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 0).frequency
|
||||
}"
|
||||
expectations[consistency.checks[1].name]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 1).name
|
||||
}"
|
||||
expectations[consistency.checks[1].frequency]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 1).frequency
|
||||
}"
|
||||
expectations[consistency.prefix]="${backups.main.consistency.extraConfig.prefix}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
one_file_system=$($yq ".location.one_file_system" $config_file)
|
||||
if [[ $one_file_system != "true" ]]; then
|
||||
fail "Expected one_file_system to be true but it was $one_file_system"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.source_directories[0]]="${
|
||||
builtins.elemAt backups.main.location.sourceDirectories 0
|
||||
}"
|
||||
expectations[location.repositories[0]]="${
|
||||
builtins.elemAt backups.main.location.repositories 0
|
||||
}"
|
||||
expectations[location.repositories[1]]="${
|
||||
builtins.elemAt backups.main.location.repositories 1
|
||||
}"
|
||||
expectations[location.one_file_system]="${
|
||||
boolToString backups.main.location.extraConfig.one_file_system
|
||||
}"
|
||||
expectations[location.exclude_patterns[0]]="${
|
||||
builtins.elemAt backups.main.location.extraConfig.exclude_patterns 0
|
||||
}"
|
||||
|
||||
expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}"
|
||||
expectations[storage.checkpoint_interval]="${
|
||||
toString backups.main.storage.extraConfig.checkpoint_interval
|
||||
}"
|
||||
|
||||
expectations[retention.keep_within]="${backups.main.retention.keepWithin}"
|
||||
expectations[retention.keep_secondly]="${
|
||||
toString backups.main.retention.keepSecondly
|
||||
}"
|
||||
expectations[retention.prefix]="${backups.main.retention.extraConfig.prefix}"
|
||||
|
||||
expectations[consistency.checks[0].name]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 0).name
|
||||
}"
|
||||
expectations[consistency.checks[0].frequency]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 0).frequency
|
||||
}"
|
||||
expectations[consistency.checks[1].name]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 1).name
|
||||
}"
|
||||
expectations[consistency.checks[1].frequency]="${
|
||||
(builtins.elemAt backups.main.consistency.checks 1).frequency
|
||||
}"
|
||||
expectations[consistency.prefix]="${backups.main.consistency.extraConfig.prefix}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
one_file_system=$($yq ".location.one_file_system" $config_file)
|
||||
if [[ $one_file_system != "true" ]]; then
|
||||
fail "Expected one_file_system to be true but it was $one_file_system"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = pkgs.writeText "excludeFile.txt" "/foo/bar";
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = true;
|
||||
};
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
hmExclusionsFile=$($yq '.location.exclude_from[0]' $config_file)
|
||||
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
|
||||
|
||||
grep --quiet "$expected_content" "$hmExclusionsFile"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Expected to find $expected_content in file $hmExclusionsFile but didn't" >&2
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
hmExclusionsFile=$($yq '.location.exclude_from[0]' $config_file)
|
||||
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
|
||||
|
||||
grep --quiet "$expected_content" "$hmExclusionsFile"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Expected to find $expected_content in file $hmExclusionsFile but didn't" >&2
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = pkgs.writeText "excludeFile.txt" "/foo/bar";
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = true;
|
||||
extraConfig = { exclude_from = [ (toString excludeFile) ]; };
|
||||
};
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = true;
|
||||
extraConfig = { exclude_from = [ (toString excludeFile) ]; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
hmExclusionsFile=$($yq '.location.exclude_from[1]' $config_file)
|
||||
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
|
||||
|
||||
grep --quiet "$expected_content" "$hmExclusionsFile"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Expected to find $expected_content in file $hmExclusionsFile but didn't" >&2
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
hmExclusionsFile=$($yq '.location.exclude_from[1]' $config_file)
|
||||
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
|
||||
|
||||
grep --quiet "$expected_content" "$hmExclusionsFile"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Expected to find $expected_content in file $hmExclusionsFile but didn't" >&2
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = pkgs.writeText "excludeFile.txt" "/foo/bar";
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = false;
|
||||
extraConfig = { exclude_from = [ (toString excludeFile) ]; };
|
||||
};
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
main = {
|
||||
location = {
|
||||
sourceDirectories = [ "/my-stuff-to-backup" ];
|
||||
repositories = [ "/mnt/disk1" ];
|
||||
excludeHomeManagerSymlinks = false;
|
||||
extraConfig = { exclude_from = [ (toString excludeFile) ]; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
declare -A expectations
|
||||
|
||||
expectations[location.exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
actual_value="$($yq ".$filter" $config_file)"
|
||||
|
||||
if [[ "$actual_value" != "$expected_value" ]]; then
|
||||
fail "Expected '$filter' to be '$expected_value' but was '$actual_value'"
|
||||
fi
|
||||
done
|
||||
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
services.barrier.client = {
|
||||
enable = true;
|
||||
server = "testServer";
|
||||
};
|
||||
|
||||
test.stubs.barrier = { };
|
||||
|
||||
nmt.script = ''
|
||||
clientServiceFile=home-files/.config/systemd/user/barrierc.service
|
||||
|
||||
assertFileExists $clientServiceFile
|
||||
assertFileRegex $clientServiceFile 'ExecStart=.*/bin/barrierc -f testServer'
|
||||
'';
|
||||
services.barrier.client = {
|
||||
enable = true;
|
||||
server = "testServer";
|
||||
};
|
||||
|
||||
test.stubs.barrier = { };
|
||||
|
||||
nmt.script = ''
|
||||
clientServiceFile=home-files/.config/systemd/user/barrierc.service
|
||||
|
||||
assertFileExists $clientServiceFile
|
||||
assertFileRegex $clientServiceFile 'ExecStart=.*/bin/barrierc -f testServer'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
{ config, pkgs, ... }: {
|
||||
config = {
|
||||
services.devilspie2 = {
|
||||
enable = true;
|
||||
{ ... }:
|
||||
|
||||
config = ''
|
||||
if (get_window_class() == "Gnome-terminal") then
|
||||
make_always_on_top();
|
||||
end
|
||||
{
|
||||
services.devilspie2 = {
|
||||
enable = true;
|
||||
|
||||
if string.match(get_window_name(), "LibreOffice Writer") then
|
||||
maximize();
|
||||
end
|
||||
config = ''
|
||||
if (get_window_class() == "Gnome-terminal") then
|
||||
make_always_on_top();
|
||||
end
|
||||
|
||||
if (get_window_class()=="Org.gnome.Nautilus") then
|
||||
set_window_geometry(1600,300,900,700);
|
||||
end
|
||||
'';
|
||||
};
|
||||
if string.match(get_window_name(), "LibreOffice Writer") then
|
||||
maximize();
|
||||
end
|
||||
|
||||
test.stubs.devilspie2 = { };
|
||||
|
||||
nmt.script = ''
|
||||
configlua=home-files/.config/devilspie2/config.lua
|
||||
|
||||
assertFileExists $configlua
|
||||
|
||||
assertFileContent $configlua ${./config.lua}
|
||||
|
||||
serviceFile=home-files/.config/systemd/user/devilspie2.service
|
||||
|
||||
assertFileExists $serviceFile
|
||||
|
||||
assertFileRegex $serviceFile 'ExecStart=.*/bin/devilspie2'
|
||||
if (get_window_class()=="Org.gnome.Nautilus") then
|
||||
set_window_geometry(1600,300,900,700);
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.devilspie2 = { };
|
||||
|
||||
nmt.script = ''
|
||||
configlua=home-files/.config/devilspie2/config.lua
|
||||
|
||||
assertFileExists $configlua
|
||||
|
||||
assertFileContent $configlua ${./config.lua}
|
||||
|
||||
serviceFile=home-files/.config/systemd/user/devilspie2.service
|
||||
|
||||
assertFileExists $serviceFile
|
||||
|
||||
assertFileRegex $serviceFile 'ExecStart=.*/bin/devilspie2'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // {
|
||||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
emacs = pkgs.writeShellScriptBin "dummy-emacs-27.2" "" // {
|
||||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
programs.emacs.enable = true;
|
||||
services.emacs.enable = true;
|
||||
services.emacs.client.enable = true;
|
||||
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
|
||||
programs.emacs.enable = true;
|
||||
services.emacs.enable = true;
|
||||
services.emacs.client.enable = true;
|
||||
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/systemd/user/emacs.socket
|
||||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/systemd/user/emacs.socket
|
||||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src = ./emacs-service-emacs.service;
|
||||
}
|
||||
}
|
||||
assertFileContent home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-27-emacsclient.desktop}
|
||||
'';
|
||||
};
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src = ./emacs-service-emacs.service;
|
||||
}
|
||||
}
|
||||
|
||||
assertFileContent \
|
||||
home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-27-emacsclient.desktop}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,40 +1,38 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
emacs = pkgs.writeShellScriptBin "dummy-emacs-28.2" "" // {
|
||||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
emacs = pkgs.writeShellScriptBin "dummy-emacs-28.2" "" // {
|
||||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
programs.emacs.enable = true;
|
||||
services.emacs.enable = true;
|
||||
services.emacs.client.enable = true;
|
||||
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
|
||||
services.emacs.startWithUserSession = "graphical";
|
||||
programs.emacs.enable = true;
|
||||
services.emacs.enable = true;
|
||||
services.emacs.client.enable = true;
|
||||
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
|
||||
services.emacs.startWithUserSession = "graphical";
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/systemd/user/emacs.socket
|
||||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/systemd/user/emacs.socket
|
||||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src =
|
||||
./emacs-service-emacs-after-graphical-session-target.service;
|
||||
}
|
||||
}
|
||||
assertFileContent home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
'';
|
||||
};
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src = ./emacs-service-emacs-after-graphical-session-target.service;
|
||||
}
|
||||
}
|
||||
|
||||
assertFileContent \
|
||||
home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
|
@ -10,7 +8,7 @@ with lib;
|
|||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -24,15 +22,18 @@ with lib;
|
|||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src = ./emacs-service-emacs.service;
|
||||
}
|
||||
}
|
||||
assertFileContent home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell;
|
||||
src = ./emacs-service-emacs.service;
|
||||
}
|
||||
}
|
||||
|
||||
assertFileContent \
|
||||
home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
in {
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
|
@ -12,7 +8,7 @@ in {
|
|||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -27,17 +23,22 @@ in {
|
|||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/emacs.socket \
|
||||
${./emacs-socket-emacs.socket}
|
||||
assertFileContent home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell coreutils;
|
||||
src = ./emacs-socket-emacs.service;
|
||||
}
|
||||
}
|
||||
assertFileContent home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-27-emacsclient.desktop}
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.socket \
|
||||
${./emacs-socket-emacs.socket}
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell coreutils;
|
||||
src = ./emacs-socket-emacs.service;
|
||||
}
|
||||
}
|
||||
|
||||
assertFileContent \
|
||||
home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-27-emacsclient.desktop}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
in {
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: rec {
|
||||
|
@ -12,7 +8,7 @@ in {
|
|||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
|
@ -27,17 +23,22 @@ in {
|
|||
assertFileExists home-files/.config/systemd/user/emacs.service
|
||||
assertFileExists home-path/share/applications/emacsclient.desktop
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/emacs.socket \
|
||||
${./emacs-socket-emacs.socket}
|
||||
assertFileContent home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell coreutils;
|
||||
src = ./emacs-socket-emacs.service;
|
||||
}
|
||||
}
|
||||
assertFileContent home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.socket \
|
||||
${./emacs-socket-emacs.socket}
|
||||
|
||||
assertFileContent \
|
||||
home-files/.config/systemd/user/emacs.service \
|
||||
${
|
||||
pkgs.substituteAll {
|
||||
inherit (pkgs) runtimeShell coreutils;
|
||||
src = ./emacs-socket-emacs.service;
|
||||
}
|
||||
}
|
||||
|
||||
assertFileContent \
|
||||
home-path/share/applications/emacsclient.desktop \
|
||||
${./emacs-28-emacsclient.desktop}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
|
@ -15,7 +13,7 @@ with lib;
|
|||
outPath = "@emacs@";
|
||||
};
|
||||
emacsPackagesFor = _:
|
||||
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
lib.makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
||||
})
|
||||
];
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
services.flameshot = { enable = true; };
|
||||
services.flameshot = { enable = true; };
|
||||
|
||||
test.stubs.flameshot = { };
|
||||
test.stubs.flameshot = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/flameshot/flameshot.ini
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/flameshot/flameshot.ini
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,30 +1,28 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
services.flameshot = {
|
||||
enable = true;
|
||||
services.flameshot = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
General = {
|
||||
disabledTrayIcon = true;
|
||||
showStartupLaunchMessage = false;
|
||||
};
|
||||
settings = {
|
||||
General = {
|
||||
disabledTrayIcon = true;
|
||||
showStartupLaunchMessage = false;
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.flameshot = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/flameshot/flameshot.ini \
|
||||
${
|
||||
builtins.toFile "expected.ini" ''
|
||||
[General]
|
||||
disabledTrayIcon=true
|
||||
showStartupLaunchMessage=false
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.flameshot = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/flameshot/flameshot.ini \
|
||||
${
|
||||
builtins.toFile "expected.ini" ''
|
||||
[General]
|
||||
disabledTrayIcon=true
|
||||
showStartupLaunchMessage=false
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
{ config, pkgs, ... }: {
|
||||
config = {
|
||||
services.fluidsynth.enable = true;
|
||||
services.fluidsynth.soundService = "pipewire-pulse";
|
||||
services.fluidsynth.soundFont = "/path/to/soundFont";
|
||||
services.fluidsynth.extraOptions = [ "--sample-rate 96000" ];
|
||||
{ ... }:
|
||||
|
||||
test.stubs.fluidsynth = { };
|
||||
{
|
||||
services.fluidsynth.enable = true;
|
||||
services.fluidsynth.soundService = "pipewire-pulse";
|
||||
services.fluidsynth.soundFont = "/path/to/soundFont";
|
||||
services.fluidsynth.extraOptions = [ "--sample-rate 96000" ];
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/fluidsynth.service
|
||||
test.stubs.fluidsynth = { };
|
||||
|
||||
assertFileExists $serviceFile
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/fluidsynth.service
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'ExecStart=@fluidsynth@/bin/fluidsynth -a pulseaudio -si --sample-rate 96000 /path/to/soundFont'
|
||||
assertFileExists $serviceFile
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'After=pipewire-pulse.service'
|
||||
assertFileContains $serviceFile \
|
||||
'ExecStart=@fluidsynth@/bin/fluidsynth -a pulseaudio -si --sample-rate 96000 /path/to/soundFont'
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'BindsTo=pipewire-pulse.service'
|
||||
'';
|
||||
};
|
||||
assertFileContains $serviceFile \
|
||||
'After=pipewire-pulse.service'
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'BindsTo=pipewire-pulse.service'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,34 +1,30 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
services.lieer.enable = true;
|
||||
services.lieer.enable = true;
|
||||
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com" = {
|
||||
flavor = "gmail.com";
|
||||
lieer = {
|
||||
enable = true;
|
||||
sync.enable = true;
|
||||
};
|
||||
notmuch.enable = true;
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com" = {
|
||||
flavor = "gmail.com";
|
||||
lieer = {
|
||||
enable = true;
|
||||
sync.enable = true;
|
||||
};
|
||||
notmuch.enable = true;
|
||||
};
|
||||
|
||||
test.stubs.lieer = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service
|
||||
assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.timer
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.service \
|
||||
${./lieer-service-expected.service}
|
||||
assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.timer \
|
||||
${./lieer-service-expected.timer}
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.lieer = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service
|
||||
assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.timer
|
||||
|
||||
assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.service \
|
||||
${./lieer-service-expected.service}
|
||||
assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.timer \
|
||||
${./lieer-service-expected.timer}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,47 +1,42 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
xsession.windowManager.bspwm = {
|
||||
enable = true;
|
||||
monitors.focused =
|
||||
[ "desktop 1" "d'esk top" ]; # pathological desktop names
|
||||
alwaysResetDesktops = false;
|
||||
settings = {
|
||||
border_width = 2;
|
||||
split_ratio = 0.52;
|
||||
gapless_monocle = true;
|
||||
external_rules_command = "/path/to/external rules command";
|
||||
ignore_ewmh_fullscreen = [ "enter" "exit" ];
|
||||
};
|
||||
rules."*" = {
|
||||
sticky = true;
|
||||
center = false;
|
||||
desktop = "d'esk top#next";
|
||||
splitDir = "north";
|
||||
border = null;
|
||||
unknownRule = 42;
|
||||
};
|
||||
extraConfigEarly = ''
|
||||
extra config early
|
||||
'';
|
||||
extraConfig = ''
|
||||
extra config
|
||||
'';
|
||||
startupPrograms = [ "foo" "bar || qux" ];
|
||||
xsession.windowManager.bspwm = {
|
||||
enable = true;
|
||||
monitors.focused = [ "desktop 1" "d'esk top" ]; # pathological desktop names
|
||||
alwaysResetDesktops = false;
|
||||
settings = {
|
||||
border_width = 2;
|
||||
split_ratio = 0.52;
|
||||
gapless_monocle = true;
|
||||
external_rules_command = "/path/to/external rules command";
|
||||
ignore_ewmh_fullscreen = [ "enter" "exit" ];
|
||||
};
|
||||
|
||||
test.stubs.bspwm = { };
|
||||
|
||||
nmt.script = ''
|
||||
bspwmrc=home-files/.config/bspwm/bspwmrc
|
||||
assertFileExists "$bspwmrc"
|
||||
assertFileIsExecutable "$bspwmrc"
|
||||
assertFileContent "$bspwmrc" ${
|
||||
pkgs.writeShellScript "bspwmrc-expected" (readFile ./bspwmrc)
|
||||
}
|
||||
rules."*" = {
|
||||
sticky = true;
|
||||
center = false;
|
||||
desktop = "d'esk top#next";
|
||||
splitDir = "north";
|
||||
border = null;
|
||||
unknownRule = 42;
|
||||
};
|
||||
extraConfigEarly = ''
|
||||
extra config early
|
||||
'';
|
||||
extraConfig = ''
|
||||
extra config
|
||||
'';
|
||||
startupPrograms = [ "foo" "bar || qux" ];
|
||||
};
|
||||
|
||||
test.stubs.bspwm = { };
|
||||
|
||||
nmt.script = ''
|
||||
bspwmrc=home-files/.config/bspwm/bspwmrc
|
||||
assertFileExists "$bspwmrc"
|
||||
assertFileIsExecutable "$bspwmrc"
|
||||
assertFileContent "$bspwmrc" ${
|
||||
pkgs.writeShellScript "bspwmrc-expected" (builtins.readFile ./bspwmrc)
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./i3-stubs.nix ];
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
|
||||
config.focus.followMouse = false;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
dmenu = super.dmenu // { outPath = "@dmenu@"; };
|
||||
|
||||
i3 = super.writeScriptBin "i3" "" // { outPath = "@i3@"; };
|
||||
|
||||
i3-gaps = super.writeScriptBin "i3" "" // { outPath = "@i3-gaps@"; };
|
||||
|
||||
i3status = super.i3status // { outPath = "@i3status@"; };
|
||||
})
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/i3/config
|
||||
assertFileContent home-files/.config/i3/config \
|
||||
${./i3-followmouse-expected.conf}
|
||||
'';
|
||||
config.focus.followMouse = false;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
dmenu = super.dmenu // { outPath = "@dmenu@"; };
|
||||
|
||||
i3 = super.writeScriptBin "i3" "" // { outPath = "@i3@"; };
|
||||
|
||||
i3-gaps = super.writeScriptBin "i3" "" // { outPath = "@i3-gaps@"; };
|
||||
|
||||
i3status = super.i3status // { outPath = "@i3status@"; };
|
||||
})
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/i3/config
|
||||
assertFileContent home-files/.config/i3/config \
|
||||
${./i3-followmouse-expected.conf}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./i3-stubs.nix ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./i3-stubs.nix ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./i3-stubs.nix ];
|
||||
|
@ -11,6 +11,6 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/i3/config
|
||||
assertFileContent home-files/.config/i3/config \
|
||||
${pkgs.writeText "expected" ""}
|
||||
${builtins.toFile "expected" ""}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./i3-stubs.nix ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
let
|
||||
i3 = {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./sway-stubs.nix ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./sway-stubs.nix ];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./sway-stubs.nix ];
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
wayland.windowManager.sway.swaynag = {
|
||||
enable = true;
|
||||
wayland.windowManager.sway.swaynag = {
|
||||
enable = true;
|
||||
|
||||
settings = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swaynag
|
||||
'';
|
||||
settings = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swaynag
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
home.username = mkForce "root";
|
||||
home.username = lib.mkForce "root";
|
||||
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = { Description = "A basic test service"; };
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = { Description = "A basic test service"; };
|
||||
|
||||
Service = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
Service = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertPathNotExists $serviceFile
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertPathNotExists $serviceFile
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -5,33 +5,31 @@ let
|
|||
echo "Just a test"
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = { Description = "A basic test service"; };
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = { Description = "A basic test service"; };
|
||||
|
||||
Service = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStartPre = drvScript;
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
Service = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStartPre = drvScript;
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent $serviceFile \
|
||||
${
|
||||
pkgs.writeText "services-expected.conf" ''
|
||||
[Service]
|
||||
Environment=VAR1=1
|
||||
Environment=VAR2=2
|
||||
ExecStart=/some/exec/start/command --with-arguments "%i"
|
||||
ExecStartPre=${drvScript}
|
||||
|
||||
[Unit]
|
||||
Description=A basic test service
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent $serviceFile \
|
||||
${
|
||||
pkgs.writeText "services-expected.conf" ''
|
||||
[Service]
|
||||
Environment=VAR1=1
|
||||
Environment=VAR2=2
|
||||
ExecStart=/some/exec/start/command --with-arguments "%i"
|
||||
ExecStartPre=${drvScript}
|
||||
|
||||
[Unit]
|
||||
Description=A basic test service
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.user.sessionVariables = {
|
||||
V_int = 1;
|
||||
V_str = "2";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||
assertFileExists $envFile
|
||||
assertFileContent $envFile ${
|
||||
pkgs.writeText "expected" ''
|
||||
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
|
||||
V_int=1
|
||||
V_str=2
|
||||
XDG_CACHE_HOME=/home/hm-user/.cache
|
||||
XDG_CONFIG_HOME=/home/hm-user/.config
|
||||
XDG_DATA_HOME=/home/hm-user/.local/share
|
||||
XDG_STATE_HOME=/home/hm-user/.local/state
|
||||
''
|
||||
}
|
||||
'';
|
||||
systemd.user.sessionVariables = {
|
||||
V_int = 1;
|
||||
V_str = "2";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||
assertFileExists $envFile
|
||||
assertFileContent $envFile ${
|
||||
pkgs.writeText "expected" ''
|
||||
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
|
||||
V_int=1
|
||||
V_str=2
|
||||
XDG_CACHE_HOME=/home/hm-user/.cache
|
||||
XDG_CONFIG_HOME=/home/hm-user/.config
|
||||
XDG_DATA_HOME=/home/hm-user/.local/share
|
||||
XDG_STATE_HOME=/home/hm-user/.local/state
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.user.slices.app-test = {
|
||||
Unit = { Description = "Slice for a test app"; };
|
||||
systemd.user.slices.app-test = {
|
||||
Unit = { Description = "Slice for a test app"; };
|
||||
|
||||
Slice = {
|
||||
MemoryHigh = "30%";
|
||||
MemoryMax = "40%";
|
||||
};
|
||||
Slice = {
|
||||
MemoryHigh = "30%";
|
||||
MemoryMax = "40%";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
sliceFile=home-files/.config/systemd/user/app-test.slice
|
||||
assertFileExists $sliceFile
|
||||
assertFileContent $sliceFile ${
|
||||
builtins.toFile "app-test-expected.conf" ''
|
||||
[Slice]
|
||||
MemoryHigh=30%
|
||||
MemoryMax=40%
|
||||
|
||||
[Unit]
|
||||
Description=Slice for a test app
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
sliceFile=home-files/.config/systemd/user/app-test.slice
|
||||
assertFileExists $sliceFile
|
||||
assertFileContent $sliceFile ${
|
||||
builtins.toFile "app-test-expected.conf" ''
|
||||
[Slice]
|
||||
MemoryHigh=30%
|
||||
MemoryMax=40%
|
||||
|
||||
[Unit]
|
||||
Description=Slice for a test app
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.user.timers.test-timer = {
|
||||
Unit = { Description = "A basic test timer"; };
|
||||
systemd.user.timers.test-timer = {
|
||||
Unit = { Description = "A basic test timer"; };
|
||||
|
||||
Timer = { OnUnitActiveSec = "1h 30m"; };
|
||||
Timer = { OnUnitActiveSec = "1h 30m"; };
|
||||
|
||||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
unitDir=home-files/.config/systemd/user
|
||||
timerFile=$unitDir/test-timer.timer
|
||||
|
||||
assertFileExists $timerFile
|
||||
assertFileContent $timerFile ${./timers-expected.conf}
|
||||
|
||||
assertFileExists $unitDir/timers.target.wants/test-timer.timer
|
||||
'';
|
||||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
unitDir=home-files/.config/systemd/user
|
||||
timerFile=$unitDir/test-timer.timer
|
||||
|
||||
assertFileExists $timerFile
|
||||
assertFileContent $timerFile ${./timers-expected.conf}
|
||||
|
||||
assertFileExists $unitDir/timers.target.wants/test-timer.timer
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue