Switch to flake-parts based flake
This commit is contained in:
parent
65d257d4ad
commit
b885d70549
78
flake.lock
78
flake.lock
|
@ -1,58 +1,78 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710146030,
|
"lastModified": 1712014858,
|
||||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"haskell-flake": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714268160,
|
||||||
|
"narHash": "sha256-LNbwGgBT5EqfWN7pqYbj71VLLGQJqWkde3ToOhkM5vM=",
|
||||||
|
"owner": "srid",
|
||||||
|
"repo": "haskell-flake",
|
||||||
|
"rev": "5b0857e0b7feec60bf00e075f7859746d52b8564",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "srid",
|
||||||
|
"repo": "haskell-flake",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713674382,
|
"lastModified": 1714314149,
|
||||||
"narHash": "sha256-1M/5T+D2obq8g5C3JZ2NnC4QGdbxcit5QkLd8ui3OYk=",
|
"narHash": "sha256-yNAevSKF4krRWacmLUsLK7D7PlfuY3zF0lYnGYNi9vQ=",
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "44fa1ee8c2b0a581804e101c8627339c3fa2fd96",
|
"rev": "cf8cc1201be8bc71b7cbbbdaf349b22f4f99c7ae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"dir": "lib",
|
||||||
|
"lastModified": 1711703276,
|
||||||
|
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"dir": "lib",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-parts": "flake-parts",
|
||||||
|
"haskell-flake": "haskell-flake",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
63
flake.nix
63
flake.nix
|
@ -1,52 +1,27 @@
|
||||||
{
|
{
|
||||||
description = "A snake game in Haskell using Dunai";
|
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
haskell-flake.url = "github:srid/haskell-flake";
|
||||||
};
|
};
|
||||||
|
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
||||||
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
|
imports = [ inputs.haskell-flake.flakeModule ];
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
systems = nixpkgs.lib.systems.flakeExposed;
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
perSystem = { config, system, self', pkgs, ... }: {
|
||||||
let
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
|
|
||||||
# package/executable name
|
|
||||||
packageName = "snake";
|
|
||||||
execName = packageName;
|
|
||||||
|
|
||||||
# version of ghc used
|
|
||||||
hp = pkgs.haskell.packages.ghc92;
|
|
||||||
|
|
||||||
project = returnShellEnv:
|
|
||||||
hp.developPackage {
|
|
||||||
inherit returnShellEnv;
|
|
||||||
name = packageName;
|
|
||||||
root = ./.;
|
|
||||||
withHoogle = false;
|
|
||||||
modifier = drv:
|
|
||||||
pkgs.haskell.lib.addBuildTools drv (with hp; [
|
|
||||||
# Specify your build/dev dependencies here.
|
|
||||||
hlint
|
|
||||||
haskell-language-server
|
|
||||||
ormolu
|
|
||||||
|
|
||||||
pkgs.mesa
|
_module.args.pkgs = import nixpkgs {
|
||||||
pkgs.mesa_glu
|
inherit system;
|
||||||
pkgs.freeglut
|
config.allowBroken = true;
|
||||||
]);
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Used by `nix build` & `nix run` (prod exe)
|
|
||||||
packages.default = project false;
|
|
||||||
|
|
||||||
apps.default = {
|
|
||||||
type = "app";
|
|
||||||
program = "${self.packages.${system}.default}/bin/${execName}";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Used by `nix develop` (dev shell)
|
haskellProjects.default = {
|
||||||
devShell = project true;
|
basePackages = pkgs.haskell.packages.ghc94;
|
||||||
});
|
};
|
||||||
|
|
||||||
|
packages.default = self'.packages.snake;
|
||||||
|
apps.default = self'.apps.snake;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,10 @@ build-type: Simple
|
||||||
executable snake
|
executable snake
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
|
other-modules: Game.Display,
|
||||||
|
Game.Engine,
|
||||||
|
Game.State,
|
||||||
|
Game.Utils
|
||||||
default-language: GHC2021
|
default-language: GHC2021
|
||||||
default-extensions: Arrows
|
default-extensions: Arrows
|
||||||
build-depends: base,
|
build-depends: base,
|
||||||
|
|
Loading…
Reference in a new issue