-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
141 lines (129 loc) · 4.05 KB
/
Copy pathflake.nix
File metadata and controls
141 lines (129 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
description = "Nix flake that pushes a container with webshell into Snowpark Container Services";
inputs = {
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-26.05";
nixpkgs.follows = "nixpkgs-stable";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};
outputs =
inputs@{ flake-parts, self, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
imports = [
inputs.devshell.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
inputs.treefmt-nix.flakeModule
];
perSystem =
{
config,
pkgs,
# These inputs are unused in the template, but might be useful later
# , self'
# , inputs'
# , system
...
}:
let
spcsTargetSystem = "x86_64-linux";
spcsTargetPkgs = import inputs.nixpkgs {
system = spcsTargetSystem;
config.allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "snowsql" ];
};
in
{
packages = rec {
ttydContainer = import ./packages/ttydContainer/package.nix {
targetPkgs = spcsTargetPkgs;
inherit self;
};
demoRunSQLas = pkgs.writeShellApplication {
name = "run-sql-as";
runtimeInputs = [ ];
text = builtins.readFile ./demos/sql-query-runner/runme-nix;
};
default = ttydContainer;
}
// pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
snowflake-odbc = pkgs.callPackage ./packages/snowflake-odbc/package.nix {
inherit (pkgs) fetchurl stdenv;
};
};
apps = {
buildAndPushToSpcs = import ./apps/buildAndPushToSpcs { inherit pkgs; };
mkService = import ./apps/mkService.nix { inherit pkgs; };
pushArchiveToSpcs = import ./apps/pushArchiveToSpcs.nix { inherit pkgs; };
};
# Development configuration
treefmt = {
programs = {
nixfmt.enable = true;
deadnix = {
enable = true;
no-lambda-arg = true;
no-lambda-pattern-names = true;
no-underscore = true;
};
statix.enable = true;
};
projectRootFile = "flake.nix";
};
pre-commit.settings = {
hooks = {
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
deadnix = {
enable = true;
settings.edit = true;
};
statix = {
enable = true;
settings = {
ignore = [ ".direnv/" ];
format = "stderr";
};
};
yamllint.enable = true;
markdownlint = {
enable = true;
settings.configuration = {
MD041 = false; # Disable "first line should be a heading check"
MD013.code_blocks = false; # disable line length check in code blocks
};
};
};
};
devShells.pre-commit = config.pre-commit.devShell;
devshells.default = {
env = [ ];
commands = [ ];
packages = builtins.attrValues {
inherit (pkgs)
jq
skopeo
act
;
};
};
};
};
}