Skip to content

Commit

Permalink
Setup flake.nix using gomod2nix
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Nov 20, 2024
1 parent c70e4ec commit 35a1d10
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ devenv.local.nix

# pre-commit
.pre-commit-config.yaml

# Nix
result
104 changes: 66 additions & 38 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,6 @@
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1730270567,
"owner": "nix-community",
"repo": "fenix",
"rev": "6535bb2a77a3bec73cc5b2d2ff63da8a479e32bd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
Expand All @@ -51,6 +31,23 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
Expand All @@ -71,18 +68,36 @@
"type": "github"
}
},
"gomod2nix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1729448365,
"owner": "nix-community",
"repo": "gomod2nix",
"rev": "5d387097aa716f35dd99d848dc26d8d5b62a104c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "gomod2nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"lastModified": 1732082877,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d0df7756dfb54b29f32ba622c28e6528242e8e6d",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"owner": "NixOS",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
Expand All @@ -101,6 +116,21 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
Expand All @@ -126,24 +156,22 @@
"root": {
"inputs": {
"devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"gomod2nix": "gomod2nix",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"rust-analyzer-src": {
"flake": false,
"systems": {
"locked": {
"lastModified": 1730315096,
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "8244f30eff828355f5ec92b2307c216d10caa25b",
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
Expand Down
1 change: 1 addition & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pkgs.aws-vault
pkgs.awscli2
pkgs.cobra-cli
pkgs.gomod2nix
pkgs.ssm-session-manager-plugin
];

Expand Down
11 changes: 6 additions & 5 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json

inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
fenix:
url: github:nix-community/fenix
inputs:
nixpkgs:
follows: nixpkgs
gomod2nix:
url: github:nix-community/gomod2nix
overlays:
- default
85 changes: 85 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "Interactive CLI for ECS";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
gomod2nix.url = "github:nix-community/gomod2nix";
gomod2nix.inputs.flake-utils.follows = "flake-utils";
gomod2nix.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs = { flake-utils, gomod2nix, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
gomod2nix.overlays.default
];
};
in
{
packages.default = pkgs.buildGoApplication {
pname = "iecs";
version = "0.1.0";
src = ./.;
modules = ./gomod2nix.toml;
};
}
);
}
Loading

0 comments on commit 35a1d10

Please sign in to comment.