fork/home-manager

git clone https://git.julia.blue/fork/home-manager

mat essfish: format user and generated .fish filesca48fced

master
1012 B50 linesraw
1{ config, pkgs, ... }:
2
3let
4
5  expectedFunc = pkgs.writeText "func.fish" ''
6    function func
7        echo foo
8    end
9  '';
10
11  expectedFuncMulti = pkgs.writeText "func-multi.fish" ''
12    function func-multi
13        echo bar
14        if foo
15            bar
16            baz
17        end
18    end
19  '';
20
21in {
22  config = {
23    programs.fish = {
24      enable = true;
25
26      formatFishScripts = true;
27
28      functions = {
29        func = ''echo "foo"'';
30        func-multi = ''
31              echo bar
32          if foo
33              bar
34                  baz
35                end
36        '';
37      };
38    };
39
40    nmt.script = ''
41      assertFileExists home-files/.config/fish/functions/func.fish
42      echo ${expectedFunc}
43      assertFileContent home-files/.config/fish/functions/func.fish ${expectedFunc}
44
45      assertFileExists home-files/.config/fish/functions/func-multi.fish
46      echo ${expectedFuncMulti}
47      assertFileContent home-files/.config/fish/functions/func-multi.fish ${expectedFuncMulti}
48    '';
49  };
50}